Put flip somewhere in your $PATH and chmod a+x it.
Copy fuck into ~/.bashrc.
| set :rails_env, :production | |
| set :unicorn_binary, "/usr/bin/unicorn" | |
| set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
| set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
| namespace :deploy do | |
| task :start, :roles => :app, :except => { :no_release => true } do | |
| run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
| end | |
| task :stop, :roles => :app, :except => { :no_release => true } do |
| #!/usr/bin/env python | |
| import MySQLdb | |
| import os, sys | |
| import pprint | |
| pp = pprint.PrettyPrinter() | |
| mysql_host = "localhost" | |
| mysql_user = "dbusername" | |
| mysql_pass = "dbpassword" |
| subnet 192.168.0.0 netmask 255.255.255.0 { | |
| range 192.168.0.100 192.168.0.200; | |
| option broadcast-address 192.168.0.255; | |
| option routers 192.168.0.1; | |
| on commit { | |
| set ClientIP = binary-to-ascii(10, 8, ".", leased-address); | |
| set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); | |
| log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac, "Hostname: ", host-decl-name)); | |
| execute("/usr/local/bin/dhcp-event", "commit", ClientIP, ClientMac, host-decl-name); | |
| } |
| 1.9.2p290 :013 > render_erb("Hey, <%= first_name %> <%= last_name %>", :first_name => "James", :last_name => "Moriarty") | |
| => "Hey, James Moriarty" |
| source :rubygems | |
| gem 'rake' | |
| gem 'sinatra' | |
| gem 'activerecord' | |
| gem 'sinatra-activerecord' | |
| # Adapters | |
| gem 'mysql2' | |
| gem 'pg' |
| #!/usr/bin/env ruby | |
| spec_hits = [] | |
| checks = { | |
| '_spec\.rb$' => ['focus:[:space:]*true'], | |
| '\.rb$' => ['binding\.pry', 'debugger'] | |
| } | |
| # Find the names of all the filenames that have been (A)dded (C)opied or (M)odified | |
| filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n") |
| #!/usr/bin/python | |
| # Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org) | |
| # The author disclaims copyright to this source code. | |
| import sys | |
| import struct | |
| import socket | |
| import time | |
| import select |
When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.
There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the