Skip to content

Instantly share code, notes, and snippets.

@andruby
andruby / ruby.rb
Created June 27, 2014 09:44
Chef recipe to install ruby from Brightbox mirror
# Install a recent version of the ruby interpreter from ppa:brightbox
include_recipe "apt"
include_recipe "build-essential"
# Add the brightbox ppa
apt_repository 'brightbox' do
uri 'http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu'
distribution node['lsb']['codename']
components ['main']
@andruby
andruby / post-receive.sh
Created January 11, 2014 11:00
post receive git hook that runs post_receive.rb if it exists in the repository
#!/bin/bash
# Shell script that should be installed on the origin server as post-receive hook
export GIT_SOURCE=$PWD
# Extract args and set environment variables for each ref pushed
while read oldrev newrev ref
do
export BEFORE=$oldrev
@andruby
andruby / gist:7869992
Created December 9, 2013 10:07
iTerm 2 (1.00.20131124) crash log in OS X 10.9 (13A603) Even after downloading again
Process: iTerm [73050]
Path: /Applications/iTerm.app/Contents/MacOS/iTerm
Identifier: com.googlecode.iterm2
Version: ???
Code Type: X86-64 (Native)
Parent Process: launchd [249]
Responsible: iTerm [73050]
User ID: 501
Date/Time: 2013-12-09 11:04:57.560 +0100
@andruby
andruby / gist:7628903
Last active December 29, 2015 06:29
Devise routes
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
@andruby
andruby / miner_bbq.sh
Created June 7, 2013 21:33
cgminer shellscripts
#!/bin/sh
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
export THREAD_CONCURRENCY=7680
export INTENSITY=12
export GPU_THREADS=2
export WORKSIZE=256
export LOOKUP_GAP=2
@andruby
andruby / User-Data
Last active December 17, 2015 07:19
Testing for EC2 cloud-init with User Data
#include
https://gist.github.com/andruby/5571940/raw/cloud-config
https://gist.github.com/andruby/5571940/raw/remote.sh
@andruby
andruby / config.xml
Last active December 16, 2015 10:19
SparkleShare Invite with announcements_url
<?xml version="1.0" encoding="UTF-8"?>
<sparkleshare>
<user>
<name>Andrew</name>
<email>andruby@example.com</email>
</user>
<notifications>True</notifications>
<folder>
[...]
</folder>
@andruby
andruby / ubuntu-vagrant-chef-bootstrap.sh
Last active December 16, 2015 06:08
Bootstrap shell script to install ruby and chef on a clean Ubuntu 12.04 ami
# postinstall.sh for Ubuntu 12.04 base ami
# Online at: https://gist.github.com/andruby/5389159
# Usage: config.vm.provision :shell, :inline => "curl 'https://gist.github.com/andruby/5389159/raw' | sudo sh"
if hash chef-client 2>/dev/null; then
echo "Chef is already installed"
else
echo "Chef is not available on the system"
echo "Bootstrapping ruby & chef"
@andruby
andruby / svn_tags_to_git.sh
Created March 15, 2013 11:28
Shell script to import svn tags to git tags. Run this after git svn clone & git svn fetch. Remove line 6 if you don't want it to push the tag to origin.
git for-each-ref refs/remotes/tags | cut -d / -f 4- |
while read ref
do
echo "creating and pushing tag: $ref"
git tag -a "$ref" -m "import svn tag $ref" "refs/remotes/tags/$ref"
git push origin tag "$ref"
done
@andruby
andruby / gist:2861712
Created June 3, 2012 03:28
Bypass Devise email reconfirmation from console
u = User.find_by_email("old@email.com")
u.email = "new@email.com"
def u.postpone_email_change?; false; end
u.save