Skip to content

Instantly share code, notes, and snippets.

View bscott's full-sized avatar
🏠

Brian Scott bscott

🏠
View GitHub Profile
@bscott
bscott / gist:4246285
Created December 9, 2012 17:55
Chef Testing Part 2.2 - validate-repository.
#!/usr/local/rvm/bin/rvm-shell 1.9.3
echo "Basic Vagrantfile functional testing ..."
vagrant status
@bscott
bscott / chef-testing-json-2.3
Created December 10, 2012 18:06
Chef Testing Part 2.3 - JSON Check
#!/usr/local/rvm/bin/rvm-shell 1.9.3
echo "Validating JSON objects..."
for i in `find data_bags -name *.json`; do
echo " $i:"
prettify_json.rb $i || exit 1
done
@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();
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('<%= node[:tallcat][:setting][:application] %>') ? getenv('<%= node[:tallcat][:setting][:application] %>') : 'production'));
@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 }'
@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 / 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 / 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 / .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 / knife_http_proxy.rb
Created May 20, 2013 01:52
http_proxy - knife
ENV[‘http_proxy’] = ‘http://apt-proxy:3142’