Skip to content

Instantly share code, notes, and snippets.

View hiremaga's full-sized avatar

Abhi Hiremagalur hiremaga

View GitHub Profile
@hiremaga
hiremaga / Output
Created March 2, 2010 22:07
Signal Handling: Ruby vs JRuby
orange:~ $ ruby signal_handling.rb
pid 81402 is sleeping...
^CRuby ensure was run!
Ruby at_exit was run!
signal_handling.rb:34:in `sleep': Interrupt
from signal_handling.rb:34
orange:~ $ jruby signal_handling.rb
pid 81431 is sleeping...
^CJava shutdown hook was run!
$ ruby -rubygems -e 'require "active_support"; class Foo; class Bar; end; class Baz; end; end; Foo::Bar::Baz'
/.../gems/activesupport-2.3.8/lib/active_support/dependencies.rb:417:in `load_missing_constant': Foo is not missing constant Baz! (ArgumentError)
from /.../gems/activesupport-2.3.8/lib/active_support/dependencies.rb:96:in `const_missing'
from /.../gems/activesupport-2.3.8/lib/active_support/dependencies.rb:98:in `send'
from /.../gems/activesupport-2.3.8/lib/active_support/dependencies.rb:98:in `const_missing'
from -e:1
$ rails c
Loading development environment (Rails 3.0.0.rc)
ree-1.8.7-2010.02 > JSON.pretty_generate(:foo => :bar)
ArgumentError: wrong number of arguments (2 for 1)
from /.../ree-1.8.7-2010.02@rails3json/gems/json-1.4.3/lib/json/common.rb:270:in `to_json'
from /.../ree-1.8.7-2010.02@rails3json/gems/json-1.4.3/lib/json/common.rb:270:in `generate'
from /.../ree-1.8.7-2010.02@rails3json/gems/json-1.4.3/lib/json/common.rb:270:in `pretty_generate'
from (irb):2
ree-1.8.7-2010.02 >
if ENV['IS_CI_BOX']
unless system('bundle check')
puts "IS_CI_BOX is set, running `bundle install`..."
system('bundle install') || raise("'bundle install' failed.")
end
end
@hiremaga
hiremaga / bootstrap.sh
Created October 17, 2011 22:04 — forked from knzai/bootstrap.sh
How I (will eventually) bootstrap my Macbook Air
#!/usr/bin/env sh
#After forking and editing YOUR_ORG to point at the right repo can be run via:
#bash <(curl -s https://raw.github.com/gist/1293973)
#if you use `curl xxx | sh` input will be messed up and there will be no pauses
#I keep XCode and gcc on a thumbdrive along with java, for speeding things up
#http://support.apple.com/downloads/DL1421/en_US/JavaForMacOSX10.7.dmg
read -p "Install XCode or gcc (http://github.com/kennethreitz/osx-gcc-installer)"
#setup your ssh keys for github
@hiremaga
hiremaga / autoloaded.rb
Created June 30, 2013 23:39
A spike to demostrate the thread (un)safety of autoload, stolen from somwhere I can't remember
sleep 1
Bar::Foo = 1
@hiremaga
hiremaga / gist:6326091
Last active December 21, 2015 15:19
Run this against a Vagrant vm created with https://github.com/hiremaga/spike-vagrant-osx
rm -rf /tmp/soloist
mkdir -p /tmp/soloist
cd /tmp/soloist
curl -LO https://github.com/hiremaga/omnibus-soloist/releases/download/1.0.1/install.sh
sudo bash install.sh
sudo chown -R $USER /opt/soloist
echo 'export PATH="/opt/soloist/bin:$PATH"' >> ~/.bash_profile && source ~/.bash_profile
git clone https://github.com/pivotal-sprout/sprout-wrap
cd sprout-wrap
soloist
@hiremaga
hiremaga / gorouter.job
Created December 27, 2013 23:04
Just an idea...
Job.describe("gorouter") do |job|
job.command = "bin/router -c /var/vcap/jobs/gorouter/config/gorouter.yml"
job.templates << "templates/gorouter.yml.erb", "config/gorouter.yml"
job.templates << "templates/logrotate.conf.erb", "config/logrotate.conf"
job.templates << "templates/syslog_forwarder.conf.erb", "config/syslog_forwarder.conf"
freq_min = job.properties.router && job.properties.router.logrotate && job.properties.router.logrotate.freq_min || 5
job.cron "*/#{freq_min} * * * * test -x /usr/sbin/logrotate && /usr/sbin/logrotate #{job.job_root}/config/logrotate.conf >> #{job.log_root}/gorouter_logrotate_cron.log 2>&1"
@hiremaga
hiremaga / strata2014-yarn-tutorial.md
Last active August 29, 2015 13:56
Strata 2014 Notes

Hadoop 2.0

Rich Raposa from Hortonworks

"Data Operating System"

  • Not just a framework for storing & processing data
  • More like an OS
  • Write applications to run "on top of Hadoop"
<html><body>
<script>alert(document.domain);</script>
</body>
</html>