Skip to content

Instantly share code, notes, and snippets.

View gosuri's full-sized avatar

Greg Osuri gosuri

View GitHub Profile
@gosuri
gosuri / baby_rocker.sh
Created November 24, 2010 20:06
Simple script to put a baby to sleep
#!/bin/sh
while [ 1 = 1 ]
do
#eject cdrom
eject
# pull the tray back in
eject -t
done
@gosuri
gosuri / backup.rake
Created May 5, 2011 20:58
Backup script to take a snapshot of the database and upload to Rockspace Cloud Files
# Backup script to take a snapshot of the database and upload to Rockspace Cloud Files
# also manages the no of backups to keep.
#
# Note: You will require a Rackspace Cloud account, more details @ http://www.rackspace.com/cloud/
#
# -------------
# Configuration
# -------------
# The script uses the database.yml for configuration. Backup database details should be
# provided for the appropriate environment.
@gosuri
gosuri / text-mate-full-screen.sh
Created August 15, 2011 20:59
text-mate-full-screen.sh
#!/bin/sh
# Install EGO TextMateFullScreen Plugin for TextMate
# Usage : bash <(curl -s https://raw.github.com/gist/1147847/2a312eb2ebf91c3eb04cc15328dc5fa1f064b199/text-mate-full-screen.sh)
git clone https://github.com/enormego/EGOTextMateFullScreen.git /tmp/EGOTextMateFullScreen
/usr/bin/xcodebuild -project /tmp/EGOTextMateFullScreen/EGOTextMateFullScreen.xcodeproj -target EGOTextMateFullScreen
open /tmp/EGOTextMateFullScreen/build/Release/EGOTextMateFullScreen.tmplugin
@gosuri
gosuri / missing-drawer-plugin.sh
Created August 15, 2011 23:50
Missing Drawer Plugin install
#!/bin/sh
curl -L https://github.com/downloads/jezdez/textmate-missingdrawer/MissingDrawer-0.4.0.tmplugin.zip | tar -xf - && open MissingDrawer.tmplugin
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'jquery-rails'
gem 'sqlite3'
gem 'pg'
gem 'ejs'
gem 'devise'
gem 'paperclip'
@gosuri
gosuri / lipsum.md
Created November 23, 2011 06:03
Hipster Lipsum

Artisanal filler text for your project.

Beard fixie carles, letterpress thundercats yr aesthetic organic locavore. Craft beer tofu scenester shoreditch before they sold out. Trust fund viral helvetica organic brooklyn. Iphone mcsweeney's banh mi, salvia freegan vice tattooed organic cred whatever art party retro etsy fixie vegan. Photo booth 3 wolf moon dreamcatcher cred hoodie butcher. Brunch mcsweeney's beard helvetica, brooklyn viral put a bird on it 3 wolf moon you probably haven't heard of them whatever fanny pack VHS gluten-free. Cosby sweater irony +1 photo booth synth tumblr you probably haven't heard of them 3 wolf moon.

+1 leggings put a bird on it, stumptown portland brunch master cleanse mixtape brooklyn artisan VHS. Before they sold out skateboard banh mi viral american apparel keytar cliche. Art party chambray single-origin coffee cardigan carles. Marfa 3 wolf moon wolf, biodiesel Austin farm-to-table master cleanse freegan cardigan you probably haven't h

@gosuri
gosuri / config_loader.rb
Created January 7, 2012 00:03
Config Loader For Rails
CONFIG = HashWithIndifferentAccess.new(YAML::load(ERB.new(IO.read(File.join(Rails.root, 'config', 'config.yml'))).result)[Rails.env])
# May not be the best approach
# Issues with Proxies limititing headers
# Headers could be cached
# Not sure of having JSON
class ApplicationController < ActionController::Base
after_filter :flash_to_headers
def flash_to_headers
@gosuri
gosuri / base62.rb
Created January 15, 2012 20:40
Base 62 in Ruby
module Base62
SIXTYTWO = ('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a
def encode( numeric )
raise ArgumentError unless Numeric === numeric
return '0' if numeric == 0
s = ''
while numeric > 0
s << Base62::SIXTYTWO[numeric.modulo(62)]
numeric /= 62