Skip to content

Instantly share code, notes, and snippets.

View khash's full-sized avatar
😷
Having fun!

Khash Sajadi khash

😷
Having fun!
View GitHub Profile
@khash
khash / trap.rb
Created March 14, 2016 11:39
Simple Ruby Signal Trap
Signal.trap("USR1") do
puts "Got a USR1"
end
Signal.trap("USR2") do
puts "Got a USR2"
end
puts "Waiting for signals..."
while true do
@khash
khash / deployer.coffee
Created December 22, 2014 12:01
Hubot script to deploy your stack using Cloud 66
# Description:
# Deploys stacks with Cloud 66
#
# Dependencies:
# "deploy": "0.0.1"
#
# Configuration:
# STAGING_HOOK_UID
#
# Commands:
@khash
khash / gist:50af4d0a75067b86bf02
Last active August 29, 2015 14:08
keybase.md

Keybase proof

I hereby claim:

  • I am khash on github.
  • I am khash (https://keybase.io/khash) on keybase.
  • I have a public key whose fingerprint is 4997 A4A4 8346 3294 2B66 2709 5B97 2C40 6E35 49BE

To claim this, I am signing this object:

#!/bin/bash
# reset.fw - Reset firewall
# set x to 0 - No reset
# set x to 1 - Reset firewall
# ---------------------------------------------------------------------------------------------------------------
# Added support for IPV6 Firewall
# ---------------------------------------------------------------------------------------------------------------
# Written by Vivek Gite <[email protected]>
# ---------------------------------------------------------------------------------------------------------------
# You can copy / paste / redistribute this script under GPL version 2.0 or above
global
maxconn 4096
user haproxy
group haproxy
daemon
defaults
option dontlognull
retries 3
option redispatch
@khash
khash / oauth.rb
Created March 4, 2014 18:35
Cloud 66 oAuth 2.0 Example
require 'rubygems'
require 'oauth2'
require 'json'
base = 'https://www.cloud66.com'
api_url = 'https://www.cloud66.com/api/2'
if File.exists? '/tmp/cloud66_oauth_test.json'
config = JSON.parse(File.read('/tmp/cloud66_oauth_test.json'))
client = OAuth2::Client.new(config['app_id'], config['app_secret'], :site => base)
@khash
khash / tfl_status.coffee
Last active June 15, 2022 11:02
London Underground Status Widget
class Dashing.TflStatus extends Dashing.Widget
echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list
wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -
apt-get update
apt-get install newrelic-sysmond
nrsysmond-config --set license_key=YOUR_LICENSE_KEY
/etc/init.d/newrelic-sysmond start
@khash
khash / cloud66_force_ip.rb
Last active December 30, 2015 01:49
A sample ruby script to force the IP address of a server within the stack
require 'rubygems'
require 'oauth2'
require 'json'
base = 'https://www.cloud66.com'
api_url = 'https://www.cloud66.com/api/2'
if File.exists? '/tmp/cloud66_oauth_test.json'
config = JSON.parse(File.read('/tmp/cloud66_oauth_test.json'))
client = OAuth2::Client.new(config['app_id'], config['app_secret'], :site => base)
@khash
khash / app.js
Last active April 21, 2018 19:38
Cloud 66 Status Page Source Code
Handlebars.registerHelper('equal', function(lvalue, rvalue, options) {
if (arguments.length < 3)
throw new Error("Handlebars Helper equal needs 2 parameters");
if( lvalue!=rvalue ) {
return options.inverse(this);
} else {
return options.fn(this);
}
});