Skip to content

Instantly share code, notes, and snippets.

View j1n6's full-sized avatar
🎯
Focusing

Jing Dong j1n6

🎯
Focusing
View GitHub Profile
[supervisord]
nodaemon=true
loglevel=debug
[program:bamboo]
redirect_stderr=true
command=/bin/bash -c "MARATHON_ENDPOINT=${MARATHON_ENDPOINT}; BAMBOO_ENDPOINT=${BAMBOO_ENDPOINT}; BAMBOO_ZK_HOST=${BAMBOO_ZK_HOST}; BAMBOO_ZK_PATH=${BAMBOO_ZK_PATH}; /var/bamboo/bamboo -bind="${BIND-:8000}" -config=${CONFIG_PATH-:config/production.example.json}"
#!/usr/bin/env ruby
require 'socket'
require 'optparse'
# Collect INFO from Redis, report it to Graphite
opts = OptionParser.new do |opts|
opts.banner = "Usage: redis-graphite.rb redis_host[:port] graphite_host [graphite_prefix(e.g. redis.cluster-name.server-identifier)]"
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
@j1n6
j1n6 / s3_ip_based_permission.md
Created November 26, 2014 11:39
Allow a single IP to access S3 Bucket

Only allow specific IP address to access this bucket via API or HTTP.

{
	"Version": "2008-10-17",
	"Id": "S3PolicyId1",
	"Statement": [
		{
 "Sid": "IPDeny",
description "Faye websockets"
start on runlevel [2345]
stop on runlevel [!2345]
#Respawn the process if it crashes
#If it respawns more than 10 times in 5 seconds stop
#respawn
respawn limit 10 5
@j1n6
j1n6 / plot.sh
Last active August 29, 2015 14:20
apache bench & gunplot
ab -n 400 -c 10 -g "perf-data.tsv" "http://example.com/"
gnuplot <<- EOF
# Let's output to a jpeg file
set terminal png size 1000,600
# This sets the aspect ratio of the graph
set size 1, 1
# The graph title
set title "Benchmark testing"
# Where to place the legend/key
sudo apt-get install smlnj
<%= link_to_remote "Create Post", :url => {:controller=>'posts', :action =>'new'}, :method => :post, :with =>"getParameters();" %>
<% @param = capture do %>
<%= javascript_tag "document.write(getParameter());" %>
<% end %>
<%= link_to_function "Create Post" do |page|
page.redirect_to "/posts/new" + "?" + @param
end %>
@current_user = mock_model(User, :id => 1)
controller.stub!(:login_required).and_return(:true)
controller.stub!(:current_user).and_return(@current_user)