Skip to content

Instantly share code, notes, and snippets.

View bscott's full-sized avatar
🏠

Brian Scott bscott

🏠
View GitHub Profile
@bscott
bscott / top_largest_files
Created August 11, 2013 00:49
Top 10 Largest Files - Linux
du -a /var | sort -n -r | head -n 10
@bscott
bscott / em_queue.rb
Created June 18, 2013 06:06
Process Queue via EM
EM.run do
queue = EM::Queue.new
queue_work = Proc.new do |data|
Worker.new.call(data)
EM.next_tick { queue.pop(&queue_work) }
end
queue.pop(&queue_work)
queue.push("here's some data")
@bscott
bscott / knife_http_proxy.rb
Created May 20, 2013 01:52
http_proxy - knife
ENV[‘http_proxy’] = ‘http://apt-proxy:3142’
@bscott
bscott / .tmux.conf
Created May 19, 2013 23:05 — forked from anonymous/tmux.conf
dotFiles
# Change the prefix key to Ctrl-a.
unbind C-b
set -g prefix C-a
# Set the screen to 256 colors.
set -g default-terminal 'xterm-256color'
# Change the last active window keybinding.
unbind l
bind C-a last-window
@bscott
bscott / Hash-unnest.rb
Created May 14, 2013 16:58
Hash unnest method
class Hash
def unnest
new_hash = {}
each do |key,val|
if val.is_a?(Hash)
new_hash.merge!(val.prefix_keys("#{key}."))
else
new_hash[key] = val
end
end
@bscott
bscott / one-liners.sh
Created April 12, 2013 04:47
one-liners
find /var/log/hadoop-0.20 -type f -name hadoop\* -mtime +30 -exec /bin/rm {} \;
eval `ssh-agent -s`
if [ -d repo ]; then (cd repo && git pull); else git clone $repourl;fi
@bscott
bscott / ruby-init.rb
Created April 11, 2013 16:09
Ruby Init Script
#!/usr/bin/env ruby
#
# app_name This is a startup script for use in /etc/init.d
#
# chkconfig: 2345 80 20
# description: Description of program / service
APP_NAME = 'app_name'
case ARGV.first
@bscott
bscott / pkill.sh
Created April 11, 2013 16:07
kill process via PID
ps auxf |grep 'python csp_build.py'|`awk '{ print "kill " $2 }'
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('<%= node[:tallcat][:setting][:application] %>') ? getenv('<%= node[:tallcat][:setting][:application] %>') : 'production'));
@bscott
bscott / server.js
Created December 16, 2012 08:27 — forked from anonymous/server.js
var http = require("http");
var port = process.env.PORT
function start() {
function onRequest(request, response) {
console.log("Request received.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();