Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'pathname'
require 'yaml'
def expand(new_yaml, yaml)
yaml.keys.each do |k|
append(new_yaml, k, yaml[k])
end
end
@tigris
tigris / gist:980166
Created May 19, 2011 04:07
Bundler issues from cron due to Dir.chdir(path) not "sticking" through a %x{} shell call
--- /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.13/lib/bundler/source.rb 2011-05-19 13:55:32.560582929 +1000
+++ source.rb 2011-05-19 13:56:23.779939014 +1000
@@ -619,7 +619,7 @@
return if has_revision_cached?
Bundler.ui.info "Updating #{uri}"
in_cache do
- git %|fetch --force --quiet --tags "#{uri}" "refs/heads/*:refs/heads/*"|
+ git %|--git-dir "#{Dir.pwd}" fetch --force --quiet --tags "#{uri}" "refs/heads/*:refs/heads/*"|
end
else
@tigris
tigris / autolink.rb
Created June 16, 2011 07:25
twitter-text-rb failure on double greater than
@tigris
tigris / chef_solo_bootstrap.sh
Created April 30, 2012 02:16 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo + Git
#!/usr/bin/env bash
GITHUB_USER="tigris"
GITHUB_PROJECT=...
GIT_BRANCH="master"
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libyaml-dev libreadline-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
@tigris
tigris / gist:3000630
Last active October 6, 2015 13:28
Sublime Text 2 user prefs
{
"auto_complete_commit_on_tab": true,
"auto_match_enabled": false,
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"fold_buttons": false,
"hot_exit": false,
"ignored_packages":
[
"Vintage"
],
@tigris
tigris / attributes.rb
Created August 3, 2012 12:27 — forked from shapeshed/unicorn
Unicorn / Monit setup
default['unicorn']['before_fork'] = %Q(
defined?(ActiveRecord::Base) && ActiveRecord::Base.connection.disconnect!
old_pid = '#{node['unicorn']['pid']}.oldbin'
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill('QUIT', File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
puts 'Old master alerady dead'
end
@tigris
tigris / Gemfile
Created August 7, 2012 08:41
Demonstrate bundler following symlinks
# /tmp/foo/Gemfile
source 'https://rubygems.org'
gem 'rake'
gem 'unicorn'
@tigris
tigris / README.md
Created September 17, 2012 14:17
Ruby Net::FTP screwing encoding?

I don't get why when I upload (ftp.put) a copy of the same file, then download that copy, ruby thinks the content is different? Obviously something in Net::FTP is screwing with my ISO-8859-1 character in the file? I dunno, still trying to track it down.

@tigris
tigris / README.md
Last active December 14, 2015 11:28
laptop re-install notes

How to backup and upgrade Dan's laptop

TODO before backup

  • Export virtual machines to ~/Documents

Files to backup before start

  • ~/.purple (pidgin config)
  • ~/.ievms (no configs, but super large so downloading again would be annoying)
source 'http://rubygems.org'
gem 'rails', '4.0.0.beta1'
gem 'sqlite3'