Skip to content

Instantly share code, notes, and snippets.

@tobias
tobias / run_tags.rb
Created January 1, 2009 16:44
A script for generating TAGS from a git hook.
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/opt/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@masuidrive
masuidrive / Rakefile
Created June 26, 2010 22:54
build Rakefile for Titanium mobile on OSX
#
# Titanium mobile Rakefile for iPhone build
#
DEV_PROVISIONING_UUID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
DEV_SIGN = "Developer name"
DEV_APP_NAME = "DevApp"
DEV_APP_ID = 'com.example.dev'
TITANIUM_SDK_VERSION = '1.3.2'
# Color Coding
# http://www.alloycode.com/2010/6/26/automatic-color-coding-for-script-console-and-irb
begin
require "ap"
IRB::Irb.class_eval do
def output_value
ap @context.last_value
end
end
rescue LoadError => e
@jasoncodes
jasoncodes / README.markdown
Created October 6, 2010 11:16
Run VMware Fusion headless at Mac OS system startup

Run VMware Fusion headless at Mac OS system startup.

I heard you like headless VMs on your Mac so I wrote this script for your launchds.

Assumptions

  • Tested on Mac OS X 10.6.4 with VMware Fusion 2.0.5 and 3.1.1.
  • A interactive user automatically logs into the system at startup. I had some issues trying to get this running without an interactive user logged in. I automatically log in for Airfoil Speakers anyway.
  • Your virtual machines live in /Virtual Machines
@thbar
thbar / Vagrantfile.rb
Created January 9, 2011 21:23
Rakefile
Vagrant::Config.run do |config|
if ENV['HACKER_BOOTSTRAP']
# initial bootstrapping
config.vm.box = "lucid32"
config.vm.provisioner = :chef_solo
config.chef.cookbooks_path = "../chef-solo/cookbooks"
# config.chef.log_level = :debug
config.chef.add_recipe "vagrant-tweaks"
else
config.vm.box = "hackerbooks"
@jayzes
jayzes / bootstrap-chef-client-osx.sh
Created January 19, 2011 19:54
commands to bootstrap chef-client on ubuntu and osx
# Run with bash < <( curl https://gist.github.com/raw/786735/bootstrap-chef-client-osx.sh )
# Switch to system Ruby
if [ -s "$HOME/.rvm/scripts/rvm" ]; then
rvm use system
fi
sudo gem install chef --no-ri --no-rdoc
sudo mkdir -p /etc/chef
sudo scp interactive@chef.factorylabs.com:/etc/chef/validation.pem /etc/chef/validation.pem
@andyl
andyl / ctags_vim_paths_gemfile.rb
Created February 18, 2011 19:08
Generates Ctags and Vim Paths from Gemfile.lock
#!/usr/bin/ruby
require 'rubygems'
require 'bundler'
=begin
This script was written to incorporate Bundler and Gemfile.lock into
Vim's tag and file-finding tools.
=end
# This code generates ctags. If a Gemfile.lock is found
source 'http://rubygems.org'
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'arel', :git => 'git://github.com/rails/arel.git'
gem 'hike', :git => 'git://github.com/sstephenson/hike.git'
gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git'
gem 'rack', :git => 'git://github.com/rack/rack.git'
gem 'rack-ssl', :git => 'git://github.com/josh/rack-ssl.git'
gem 'rack-cache', :git => 'git://github.com/rtomayko/rack-cache.git'
@jjb
jjb / gist:996292
Created May 27, 2011 22:11
How to securely acquire the Mozilla root certificate bundle for use with curl, Net::HTTP, etc.

If you want to use curl or net-http/open-uri to access https resources, you will often (always?) get an error, because they don't have the large number of root certificates installed that web browsers have.

You can manually install the root certs, but first you have to get them from somewhere. This article gives a nice description of how to do that. The source of the cert files it points to is hosted by the curl project, who kindly provide it in the .pem format.

problem: Sadly, ironically, and comically, it's not possible to access that file via https! Luckily, the awesome curl project does provide us with the script that they use to produce the file, so we can do it securely ourselves. Here's how.

  1. git clone https://github.com/bagder/curl.git
  2. cd curl/lib
  3. edit mk-ca-bundle.pl and change: