This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, abort, request | |
import json | |
import subprocess | |
import hashlib | |
import os | |
app = Flask(__name__) | |
@app.route("/submit", methods=["POST"]) | |
def submit(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su | |
add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java7-installer | |
mkdir /usr/local/share/spark | |
curl http://d3kbcqa49mib13.cloudfront.net/spark-2.1.0-bin-hadoop2.7.tgz | tar xvz -C /usr/local/share/spark | |
cd /usr/local/share/spark/spark-2.1.0-bin-hadoop2.7/ | |
./bin/run-example SparkPi 10 # output should contain Pi | |
# add this to your .bashrc | |
export SPARK_HOME=/usr/local/share/spark/spark-2.1.0-bin-hadoop2.7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS1='\[\e[0;31m\][PRODUCTION]\[\e[0m\][\u@\[\e[0;92m\]\h\[\e[0m\]:\[\e[0;96m\]\w\[\e[0m\]] $ ' # production | |
PS1='\[\e[0;36m\][STAGING]\[\e[0m\][\u@\[\e[0;92m\]\h\[\e[0m\]:\[\e[0;96m\]\w\[\e[0m\]] $ ' # staging | |
PS1='\[\e[0;31m\][PRODUCTION]\[\e[0m\][\u@\[\e[0;92m\]\h\[\e[0m\]:\[\e[0;96m\]\w\[\e[0m\]]\[\e[1;31m\][ROOT]\[\e[0m\] # ' # production root | |
PS1='\[\e[0;36m\][STAGING]\[\e[0m\][\u@\[\e[0;92m\]\h\[\e[0m\]:\[\e[0;96m\]\w\[\e[0m\]]\[\e[1;31m\][ROOT]\[\e[0m\] # ' # staging root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack' | |
require 'json' | |
class ApiApp | |
def initialize | |
@views = {} | |
end | |
def call(env) | |
req = Rack::Request.new(env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeService | |
# http status of operation | |
attr_reader :status | |
# result of service work for example: { errors: { email: ['should not be empty'] }, user: { id: 32, email: nil, ... } } | |
attr_reader :result | |
def self.call(params) | |
new(params).perform! | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"always_show_minimap_viewport": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme", | |
"draw_white_space": "all", | |
"font_size": 14, | |
"highlight_line": true, | |
"ignored_packages": | |
[ | |
"Vintage" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
folder_path = ENV['FOLDER'] | |
from = Regexp.new(ENV['FROM']) | |
to = ENV['TO'] | |
Dir.glob(folder_path + "*").sort.each do |f| | |
filename = File.basename(f, File.extname(f)) | |
new_filename = filename.gsub(from, to) | |
File.rename(f, folder_path + new_filename + File.extname(f)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.directive('jquery-change', { | |
twoWay: true, | |
bind: function() { | |
var self = this; | |
$(self.el).on('change', function() { | |
self.set(this.value); | |
}); | |
}, | |
update: function(data) { | |
if(data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% PACK SECTION | |
pack([X|Unpacked], Packed) :- pack(Unpacked, [[X]], Packed). | |
pack([H|T], [[H|Acc]|Rest], Packed) :- pack(T, [[H,H|Acc]|Rest], Packed). | |
pack([X|T], [[Y|Acc]|Rest], Packed) :- | |
X \= Y, | |
pack(T, [[X],[Y|Acc]|Rest], Packed). | |
pack([], RPacked, Packed) :- reverse(RPacked, Packed). | |
% UTILS SECTION |
NewerOlder