This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jose@jose-laptop:~/package/scripts$ sprinkle -c -s sprinkle.rb | |
--> Cloud hierarchy for policy scootypuff | |
Policy scootypuff requires package sqlite3 | |
Policy scootypuff requires package sqlite3_driver | |
Package sqlite3_driver requires rubygems | |
Package rubygems requires build_essential | |
Package rubygems requires ruby | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pablo@pablo-desktop:~/package$ cd scripts/ | |
pablo@pablo-desktop:~/package/scripts$ sprinkle -c -s sprinkle.rb | |
--> Cloud hierarchy for policy scootypuff | |
Policy scootypuff requires package sqlite3 | |
Policy scootypuff requires package sqlite3_driver | |
Package sqlite3_driver requires rubygems | |
Package rubygems requires build_essential | |
Package rubygems requires ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A master programmer passed a novice programmer one day. The master | |
noted the novice's preoccupation with a hand-held computer game. "Excuse me", | |
he said, "may I examine it?" | |
The novice bolted to attention and handed the device to the master. | |
"I see that the device claims to have three levels of play: Easy, Medium, | |
and Hard", said the master. "Yet every such device has another level of play, | |
where the device seeks not to conquer the human, nor to be conquered by the | |
human." | |
"Pray, great master," implored the novice, "how does one find this | |
mysterious setting?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run with: curl -s http://gist.github.com/265272.txt | bash | |
set -e | |
localdir=$HOME/.mongodb | |
datadir=$localdir/data | |
conf=$localdir/mongod.conf | |
agent=$HOME/Library/LaunchAgents/org.mongodb.mongod.plist | |
brew install mongodb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emacs -q --eval '(condition-case err (progn (load "~/.emacs") (kill-emacs 0)) (error (kill-emacs 1)))' | |
# Source http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/bed5b2bd8b237f5a?pli=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Guide | |
# Configure the essential configurations below and do the following: | |
# | |
# Repository Creation: | |
# cap deploy:repository:create | |
# git add . | |
# git commit -am "initial commit" | |
# git push origin master | |
# | |
# Initial Deployment: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# History search with up and down arrow keys | |
bindkey '^[[A' history-beginning-search-backward | |
bindkey '^[[B' history-beginning-search-forward |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rexml/parsers/pullparser' | |
require 'htmlentities' | |
class String | |
# Truncate strings containing HTML code | |
# Usage example: "string".truncate_html(50, :word_cut => false, :tail => '[+]') | |
def truncate_html(len = 30, opts = {}) | |
opts = {:word_cut => true, :tail => ' ...'}.merge(opts) | |
p = REXML::Parsers::PullParser.new(self) | |
tags = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# S3 Backup Task for MySQL & SQLite | |
# Assumes InnoDB tables | |
# If using MySQL database user needs the "reload" permission on the database (for --flush-logs in mysqldump) | |
# | |
# Stores files in Amazon S3 using the excellent AWS Gem: http://amazon.rubyforge.org/ | |
# For information about Amazon S3: http://aws.amazon.com/s3 | |
# | |
# Installation | |
# 1) Install AWS Gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for cron job | |
# 0 3 * * * cd /path/to/app/ && /usr/local/bin/rake db:backup RAILS_ENV=production | |
require 'find' | |
namespace :db do | |
desc "Backup the database to a file. Options: DIR=base_dir RAILS_ENV=production MAX=20" | |
task :backup => [:environment] do | |
datestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S") | |
base_path = ENV["DIR"] || "db" | |
backup_base = File.join(base_path, 'backup') |
OlderNewer