Skip to content

Instantly share code, notes, and snippets.

View bendangelo's full-sized avatar

Ben D'Angelo bendangelo

View GitHub Profile
@bendangelo
bendangelo / Ruby-Debug Install
Created May 19, 2012 07:03
Install ruby-debug for ruby 1.9.3p194
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p194 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@bendangelo
bendangelo / S3InstallUbuntu
Created May 22, 2012 06:52
One line install S3cmd on Ubuntu
# Install with:
# bash < <(curl -L https://raw.github.com/gist/2767174)
echo "Installing S3cmd..."
wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | sudo apt-key add -
sudo wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list
sudo apt-get update && sudo apt-get install s3cmd
echo "Done"
@bendangelo
bendangelo / PaperclipStringFile
Created May 23, 2012 15:47
Paperclip string to file
module Paperclip
#converts a string into a file for paperclip to save
# useage
# self.avatar = Paperclip::string_to_file('bob.png', 'image/png', 'BASE64 here')
def self.string_to_file(name, type, data)
image = StringIO.new(data)
image.class.class_eval { attr_accessor :original_filename, :content_type }
image.original_filename = name
image.content_type = type
@bendangelo
bendangelo / Workspaces
Created June 9, 2012 18:35
More workspaces on ubuntu
gconftool-2 --type=int --set /apps/compiz-1/general/screen0/options/vsize 3
gconftool-2 --type=int --set /apps/compiz-1/general/screen0/options/hsize 3
@bendangelo
bendangelo / S3 Rake Task
Created June 13, 2012 18:21
S3 upload rake task
require 'aws/s3'
require 'digest/md5'
require 'mime/types'
#load config yml
CONFIG = YAML.load_file("config/config.yml")
## These are some constants to keep track of my S3 credentials and
## bucket name. Nothing fancy here.
@bendangelo
bendangelo / Install Nodejs Ubuntu
Created June 23, 2012 14:39
Install Stable Nodejs on Ubuntu
# curl -L https://raw.github.com/gist/2978533 | bash
sudo -s
apt-get install python-software-properties
apt-add-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs npm -y
@bendangelo
bendangelo / Install Redis Ubuntu
Created June 23, 2012 14:54
Install Stable Redis on Ubuntu
# curl -L https://raw.github.com/gist/2978560 | bash
# /etc/apt/sources.list.d/dotdeb.org.list
sudo -s
echo -e "deb http://packages.dotdeb.org stable all\ndeb-src http://packages.dotdeb.org stable all" > /etc/apt/sources.list.d/dotdeb.org.list
wget -q http://www.dotdeb.org/dotdeb.gpg -O- | apt-key add -
apt-get update
apt-get install redis-server
@bendangelo
bendangelo / Setup SSH Key
Created June 23, 2012 14:55
Setup SSH Public Key
# curl -L https://gist.github.com/raw/2978569 | bash
# setup your ssh keys for github
echo "Please enter your email: "
read email
ssh-keygen -t rsa -C "$email"
cat ~/.ssh/id_rsa.pub
cat ~/.ssh/id_rsa.pub | pbcopy
read -p "\n\nYour ssh public key has been copied to your clipboard. Add it to github and press any key to continue"
@bendangelo
bendangelo / MongoDB Init
Created June 23, 2012 16:27
MongoDB Init.d
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@bendangelo
bendangelo / Redis Conf
Created June 23, 2012 16:31
Redis Conf
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes