Skip to content

Instantly share code, notes, and snippets.

View bagwanpankaj's full-sized avatar

Pankaj Bagwan bagwanpankaj

View GitHub Profile
@bagwanpankaj
bagwanpankaj / show
Created July 22, 2011 05:49 — forked from superchink/show
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".webhostology.com"
REMOTE="$2$DOMAIN"
ssh -tR 8080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:8080 localhost"
}
@bagwanpankaj
bagwanpankaj / show.py
Created July 22, 2011 05:48 — forked from lfborjas/show.py
Tunnel a local port to a remote host (like showoff.io does)
#!/usr/bin/python
#usage python show.py <local_port>
'''
Taken from: https://gist.github.com/932137 (found in http://news.ycombinator.com/item?id=2467107 )
Let's say you have a webapp running in localhost (with `manage.py runserver` in django or `ruby script.rb` in sinatra or `rails server` or whatever) and you want others to be able to see it with a public url without deploying remotely.
ssh provides a neat facility for that: tunneling. You set up a "tunnel" from the remote host to yours and vice-versa and then you give the remote host's url and it will send all of its requests to your local daemon.
@bagwanpankaj
bagwanpankaj / factories.rb
Created July 5, 2011 08:58 — forked from technicalpickles/factories.rb
Factory Girl definition for Paperclip
Factory.define :application do |factory|
factory.attachment(:sample, "public/samples/sample.doc", "application/msword")
end
@bagwanpankaj
bagwanpankaj / unicorn.rb
Created July 4, 2011 02:24 — forked from defunkt/gist:206253
Uncorn config File
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true