Skip to content

Instantly share code, notes, and snippets.

View shanesveller's full-sized avatar
💭
I may be slow to respond.

Shane Sveller shanesveller

💭
I may be slow to respond.
View GitHub Profile
@shanesveller
shanesveller / textmate-bundles-update.sake.rb
Created November 21, 2008 19:18
Sake task to update local version-controlled Textmate bundles
desc 'Update all svn- and git-based bundles in TextMate'
task 'textmate:bundles:update' do
BUNDLES = (Dir[(ENV["HOME"] + "/Library/Application Support/TextMate/Bundles/*")] + Dir[(ENV["HOME"] + "/Library/Application Support/TextMate/Pristine Copy/Bundles/*")])
for subdir in BUNDLES do
if File.exist?((subdir + "/.git/config")) then
sh("cd #{subdir.gsub(" ", "\\ ")} && git pull")
elsif File.exist?((subdir + "/.svn/entries")) then
sh("cd #{subdir.gsub(" ", "\\ ")} && svn up")
end
end
@shanesveller
shanesveller / ssh-keys.sake.rb
Created November 21, 2008 19:30
Sake task to copy your DSA SSH pubkey to a remote host's authorized_keys
desc 'Copy ssh-key to authorized_keys on $HOST for $USER'
task 'ssh:keys' do
host = (ENV["HOST"]
user = (ENV["USER"]
if (host and user) then
sh("ssh #{user}@#{host} 'mkdir -p .ssh/'")
sh("cat .ssh/id_dsa.pub | ssh #{user}@#{host} 'cat >> .ssh/authorized_keys'")
end
end
@shanesveller
shanesveller / remote-git-repo.sake.rb
Created November 21, 2008 19:36
Sake task to remotely create a bare git repo
desc 'Create a new git repository at $GITUSER@$HOST:$REPO/'
task 'git:repo:new' do
user = (ENV["GITUSER"] or "git")
host = ENV["HOST"]
repo = ENV["REPO"]
system("ssh root@#{host} 'cd /home/git/ && mkdir -p #{repo} && cd #{repo} && git --bare init && chown -R git:git /home/git/#{repo}'")
end
# Must have root access, repo owner defaults to 'git'
# Using root user is to account for my preference to use git-shell as the shell on my 'git' user accounts
@shanesveller
shanesveller / item.rb
Created December 2, 2008 19:07
Delete all Items not referred to by at least one Toon
class Item
include DataMapper::Resource
property :id, Integer, :key => true
property :name, String
property :icon_base, String
property :item_type, String
for prop in [:max_dura,:slot,:quality]
@shanesveller
shanesveller / access-key.rb
Created December 5, 2008 20:37
Generates a 32-length random key of /[0-9A-F]/ characters
Array.new(16) { rand(256) }.pack('C*').unpack('H*').first
# => b3512f4972d314da94380e1a70e6814a
# Courtesy of http://norbauer.com/notes/generating-access-keys
# via rubyjudo.com
abstract (1.0.0)
actionmailer (2.2.2)
actionpack (2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.2.2, 1.15.6)
activeresource (2.2.2)
activesupport (2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
adamcooke-key-installer (1.1)
addressable (2.0.1)
abstract (1.0.0)
actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
addressable (2.0.1)
andand (1.3.1)
atom (0.3)
cgi_multipart_eof_fix (2.5.0)
require 'rubygems'
require "extlib"
require "merb-core"
require "dm-core"
require "dm-timestamps"
require "dm-types"
require "dm-validations"
@shanesveller
shanesveller / unattended-passenger-ree.sh
Created December 22, 2008 21:59 — forked from maran/Unattended Rails (Passenger, Ruby Enterprise) Stack
No changes here yet, this is just for my own reference
#!/bin/bash
VERSION="1.1"
REEV="http://rubyforge.org/frs/download.php/58677/ruby-enterprise-1.8.6-20090610.tar.gz"
REEF="ruby-enterprise-1.8.6-20090610.tar.gz"
REEFF=${REEF%".tar.gz"}
PASSENGER="2.2.4"
echo "#####################################"
echo "Welcome, let's get this party rollin'"
echo "#####################################"
@shanesveller
shanesveller / gist:39691
Created December 24, 2008 14:56 — forked from peterc/gist:33337
Super Daring App Template 1.0 for Rails 2.3
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"