Skip to content

Instantly share code, notes, and snippets.

View johndel's full-sized avatar
🖖

John Deliyiannis johndel

🖖
View GitHub Profile
@johndel
johndel / redis.conf
Created October 3, 2014 14:53
Redis conf for monit
check process redis-server
with pidfile "/var/run/redis/redis-server.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
@johndel
johndel / nginx1.conf
Last active August 29, 2015 14:07
Nginx conf for monit
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
@johndel
johndel / ssh.conf
Created October 3, 2014 14:56
ssh conf for monit
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/ssh start"
stop program "/etc/init.d/ssh stop"
@johndel
johndel / your_project_unicorn.conf
Created October 3, 2014 14:59
unicorn conf for monit
check process your_project_unicorn
with pidfile /your_project_unicorn/current/tmp/pids/unicorn.pid
start program = "/bin/bash -l -c 'cd /your_project_unicorn/current && bundle exec unicorn -E staging -c /your_project_unicorn/current/config/unicorn.rb -D'"
stop program = "/bin/bash -l -c kill -QUIT `cat /your_project_unicorn/current/tmp/pids/unicorn.pid`
@johndel
johndel / your_project_sidekiq.conf
Created October 3, 2014 15:01
sidekiq conf for monit
check process your_project_sidekiq
with pidfile /your_project/current/tmp/pids/sidekiq.pid
start program = "/bin/bash -l -c 'cd /your_project/current && bundle exec sidekiq -e staging -C config/sidekiq.yml -d -P tmp/pids/sidekiq.pid -L log/sidekiq.log'"
stop program = "/bin/bash -l -c kill -s TERM `cat /your_project/current/tmp/pids/sidekiq.pid`"
@johndel
johndel / viva_payment.rb
Created October 27, 2014 16:16
Viva Payment
if Rails.env.production?
@viva_url = "https://www.vivapayments.com"
@rest = RestClient::Resource.new "#{@viva_url}/api/orders", :user => "user_id4", :password => "password"
else
@viva_url = "http://demo.vivapayments.com"
@rest = RestClient::Resource.new "#{@viva_url}/api/orders", :user => "user_id", :password => "password"
end
email = @order.email
phone = @order.phone
zX-Ji-vkP78db-pNC7tVKGT97Zff92zW5cvAvH1Ini0.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTQ0ODg3OTk0MCwicGFnZSI6eyJpZCI6IjE0NDYwNDA0MzkwMTY4MzgiLCJhZG1pbiI6dHJ1ZX0sInVzZXIiOnsiY291bnRyeSI6ImdyIiwibG9jYWxlIjoiZW5fVVMiLCJhZ2UiOnsibWluIjoyMX19fQ
{"algorithm"=>"HMAC-SHA256", "issued_at"=>1448879940, "page"=>{"id"=>"1446040439016838", "admin"=>true}, "user"=>{"country"=>"gr", "locale"=>"en_US", "age"=>{"min"=>21}}}
<%= FBGraph::Canvas.parse_signed_request(your_fb_app_secret_key, params[:signed_request]) %>
@johndel
johndel / hn_seach.js
Created December 2, 2015 10:13 — forked from kristopolous/hn_seach.js
hn job query search
function query() {
var
total = 0, shown = 0,
// HN is done with very unsemantic classes.
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')),
query_list = Array.prototype.slice.call(arguments);
// This traverses up the dom stack trying to find a match of a specific class
function up_to(node, klass) {
if (node.className === klass) {