Skip to content

Instantly share code, notes, and snippets.

@Toady00
Toady00 / .inputrc
Created February 27, 2014 21:10
inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@Toady00
Toady00 / example_usage.rb
Last active January 2, 2016 23:49
I wrote it, but I'm not sure I like it?
# Dynamically creating the correct url for downloading elasticsearch package via version number
download_url = "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.10.deb" # can we say elasticsearch one more time?
template = '<%= "https://download.#{@domain}.org/#{@domain}/#{@domain}/#{@domain}-#{@major}.#{@minor}.#{@patch}.deb" %>'
vars = {domain: 'elasticsearch', major: 0, minor: 90, patch: 10}
url_template = UrlTemplate.new(template, vars)
url_template.url == download_url
@Toady00
Toady00 / graft.sh
Created August 22, 2013 20:42
Process for grafting svn commits to git repo after cloning with the --no-metadata option.
# This assumes you prefixed all the svn branches with 'svn/' via the
# --prefix=svn/ option when you performed the initial clone. Otherwise
# replace 'svn/trunk' with the name of your branch that corresponds to
# trunk.
git svn fetch --revision [start_revision_number]:[end_revision_number]
GRAFT_PARENT_GIT=`git log --pretty=format:'%H' -1 master
GRAFT_FIRST_SVN=`git log --pretty=format:'%H' svn/trunk | tail -n` # or whatever you called your trunk
echo $GRAFT_PARENT_GIT $GRAFT_FIRST_SVN > .git/info/grafts
git checkout master
@Toady00
Toady00 / JRuby.rb
Created July 14, 2013 05:08
JRuby discrepancy with Time.
# irb session using: jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_13-b20 [darwin-x86_64]
Time.new(2013, 1, 1, 12, 0, 0, "-05:00")
#=> 2013-01-01 12:00:00 +0500
Time.new(2013, 1, 1, 12, 0, 0, "+05:00")
#=> 2013-01-01 12:00:00 -0500
@Toady00
Toady00 / DupTest.rb
Created April 2, 2013 19:48
Testing out passing values.
class DupTest
def initialize(options = {})
options = options.dup
options[:from_init] = true
puts options
end
end
# => nil
options = {from_init: false}
@Toady00
Toady00 / Vagrantfile
Last active December 15, 2015 08:19
Issue using VMware Fusion Vagrant provider. Only works when prefixed with "sudo". Mac OS X 10.8.3 Vagrant 1.1.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define :zk1 do |zk_config|
zk_config.vm.network :private_network, ip: "192.168.123.10"
zk_config.vm.box = "precise64"
end
end
@Toady00
Toady00 / gist:4601707
Created January 23, 2013 03:38
Error running remote commands via torquebox-remote-deployer.
$ rake torquebox:remote:exec["chmod +x $TORQUEBOX_HOME/stage/blog/vendor/bundle/jruby/1.9/bin/*"]
SyntaxError: /bin/chmod:1: Invalid char `\177' ('') in expressionELF>è#@@0Ã@8 @@@@@ø88@8@@@œ¶œ¶ ¾ ¾` ¾ H¾H¾`H¾`TT@T@DDPåtdx x @x @QåtRåtd ¾ ¾` ¾`àà/lib64/ld-linux-x86-64.so.2GNUGNU‚=ÿ䍨N¯2áIÚ|áçÜꎐ(<¢!@’
–hH€" <@G(ŒÜKaÆ
9Š’ûpò¼Pvž†ð–|BȒ– ‰—Î,cräbAõ9ò‹2Ä÷²¢÷§ÿÅâ¹!O¿!å>m:fë—#†ÂGI^`Ýpa2€
s {f×*5t9ΰy©=(2€y±¯ÀÞB‹ “PP¡ o@-WPe@Å TPo@ô”@0@€`@ŠÅ!pŸpÂð!@»xÂW`Â`©hÂd@5__gmon_start__libc.so.6fflushstrcpy__printf_chkreaddirsetlocalembrtowcstrncmpoptindstrrchrdcgettextclosedirfchdirerror__stack_chk_fail__lxstatiswprintreallocfstatfsabort_exitprogram_invocation_name__assert_fail__ctype_get_mb_cur_maxfts_closecallocstrlenmemset__errno_locationmemcmpfchmodat__fprintf_chkstdoutfts_readlseekmemcpyfclosemallocumaskfd
@Toady00
Toady00 / index.html
Created November 19, 2012 05:50
A CodePen by Brandon Dennis. Particle System - Attempt at canvas based particle system. Currently trying to get particle system to stream instead of generate all particles simultaneously.
<div class='particles'></div>
@Toady00
Toady00 / bash_setup.sh
Last active October 10, 2015 23:38
Script to copy dot files from gist into place
#!/bin/bash
mkdir ~/.bundle
curl https://gist.githubusercontent.com/Toady00/3769131/raw/4fef2f8f0e007ba37058ff3a2b31d45bc08f613b/bundle_config > ~/.bundle/config
curl https://gist.githubusercontent.com/Toady00/3769131/raw/d1402476a0f0aba91cdbe2180668b6ca48fe586f/.bash_aliases > ~/.bash_aliases
curl https://gist.githubusercontent.com/Toady00/3769131/raw/32fb14f7deb0670bbcd76c579d4fa9cca087ca85/.bash_profile > ~/.bash_profile
curl https://gist.githubusercontent.com/Toady00/3769131/raw/be799a6eef7fa4fac7e50f56d99079037a50e27a/.bash_prompt > ~/.bash_prompt
curl https://gist.githubusercontent.com/Toady00/3769131/raw/777a96d5b812f0bb05a50b5403b87eef82f6f495/.bash_rvm > ~/.bash_rvm
curl https://gist.githubusercontent.com/Toady00/3769131/raw/9834cfdbf5bb642fdd3e9e4090f7157920072f35/.bash_nvm > ~/.bash_nvm
@Toady00
Toady00 / .bash_aliases
Last active October 10, 2015 23:38
My current dot bash setup
alias la='ls -a'
alias ll='ls -alF'
alias df="df -h"
alias ping="ping -c 4"
alias sping="sudo ping -i 0.1"
alias tb="torquebox"
alias xcode="open -a /Application/Xcode.app"
# http://alias.sh