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 / gist:1505052
Created December 21, 2011 07:18
Fix corrupt Solr index files
># java -ea:org.apache.lucene -cp /var/lib/chef/solr/solr-jetty/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-core-2.9-dev.jar org.apache.lucene.index.CheckIndex -fix /var/cache/chef/solr/data/index/
@clifferson
clifferson / gist:2976040
Created June 23, 2012 00:51
Ruby inline if
test ? affirmative : negative
@clifferson
clifferson / gist:3132747
Created July 17, 2012 23:07
how to build rpm build root dir
rpmdev-setuptree
rpmbuild --buildroot
@clifferson
clifferson / gist:3138612
Created July 18, 2012 20:22
Make awk do some grep
If you want to search field one for (part of) a string:
awk '$1 ~ /search string/ { print $2 }' example.txt
If the search string should match anywhere in the line (all fields):
awk '/search string/ { print $2 }' example.txt
@clifferson
clifferson / gist:3177657
Created July 25, 2012 18:17
Output the public key for a private key.
ssh-keygen -y -f <private key file>
value = 5; while value > 0; value -= sleep(value); end
@clifferson
clifferson / gist:3369464
Created August 16, 2012 11:26
Put a comma after each line except the last when generating a template in chef
rack_map = {
<% counter = @options.size %>
<% @options.each do |key, value| %>
<% counter -= 1 %>
'<%= key %>' => '<%= value %>'<%= ',' unless counter == 0 %>
<% end %>
}