Skip to content

Instantly share code, notes, and snippets.

View clifferson's full-sized avatar

Cliff Erson clifferson

  • Riot Games
  • Las Vegas
View GitHub Profile
@clifferson
clifferson / Futon SSH Tunnel
Created October 22, 2011 00:20 — forked from ngpestelos/Futon SSH Tunnel
Access Futon/Couch via ssh tunnel
Problem: You want to access Futon on a remote server but do not want port 5984 to listen for outside connections.
Solution: Tunnel through a local port using SSH. [1]
Example:
ssh -L5984:127.0.0.1:5984 ssh.example.com
Access:
@clifferson
clifferson / gist:1325580
Created October 30, 2011 06:24 — forked from ivey/gist:1304518
bundle function for rake, etc.
# http://twistedmind.com/bundle-exec-bash-shortcut
bundle_commands=( rake spec rspec cucumber cap watchr rails rackup )
function run_bundler_cmd () {
if [ -e ./Gemfile ]; then
echo "bundle exec $@"
bundle exec $@
else
echo "$@"
$@
fi
@clifferson
clifferson / gist:1446536
Created December 8, 2011 09:16 — forked from mmatsumura/gist:1444362
delay execution
execute "chown tomcat" do
command "chown -R #{node[:tomcat][:config][:user]} #{node[:tomcat][:config][:home]}"
action :nothing
end
ruby_block "delay chown tomcat" do
block {}
notifies :run, resources(:execute => "chown tomcat")
end
@clifferson
clifferson / noit.rb
Created August 17, 2012 04:51 — forked from thommay/noit.rb
Modify a file line inline in chef
ruby_block "configure #{p} module" do
block do
require 'chef/util/file_edit'
nc = Chef::Util::FileEdit.new("/etc/reconnoiter/noit.conf")
nc.insert_line_after_match(/lua.*noit.module.smtp/, "<module loader=\"lua\" name=\"#{p}\" object=\"noit.module.#{p}\"/>")
nc.write_file
Chef::Log.info "Inserted module config for #{p}"
end
http://tickets.opscode.com/browse/CHEF-78?focusedCommentId=10781&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-10781
@clifferson
clifferson / knife-config
Created November 10, 2012 04:11 — forked from capoferro/knife-config
Shell script to swap knife configs
#!/bin/sh
die () {
echo >&2 "$@"
exit 1
}
available_configs () {
echo "Available configs:"
ls -A ~ | grep .chef- | sed 's/.chef-//'
}
@clifferson
clifferson / hack.sh
Created December 6, 2012 13:30 — forked from DAddYE/hack.sh
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@clifferson
clifferson / gist:4399205
Last active December 10, 2015 07:09 — forked from grantm/gist:4367372
scp override function for when you forget the :.
# a useful addition to anyone's .bashrc
#
# Note, you don't want this function in effect on the remote host side of the scp transfer,
# so make sure to only define it for interactive shells, e.g.: wrap with: if [ ! -z "$PS1" ]
function scp() {
if echo "$@" | grep -q ':'
then
/usr/bin/scp "$@"
else