This file contains hidden or 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
#!/usr/bin/env ruby | |
# Give me two arguments. | |
# 1) the path of the pwsafe xml file to import | |
# 2) the path of the csv to export | |
# format of lastpass data | |
# url,username,password,extra,name,grouping,fav | |
require 'nokogiri' |
This file contains hidden or 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
class Event < ActiveRecord::Base | |
has_many :artists | |
end | |
class Artist < ActiveRecord::Base | |
def self.make_me_an_artist | |
create! do |artist| |
This file contains hidden or 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
UUID=1229D978-XXXX-XXXX-827E-0DE28E523720 none hfs rw,noauto |
This file contains hidden or 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
# Stash only specific files | |
# Stage the files you want to keep and run.. | |
git stash --keep-index |
This file contains hidden or 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
def colour_combinations(colours=[]) | |
colours.flat_map{|x| colours.flat_map{|y| x <= y ? [[x, y]] : [] } } | |
end | |
require 'minitest/autorun' | |
require 'minitest/unit' | |
class TestColours < MiniTest::Unit::TestCase | |
def test_colour_combinations |
This file contains hidden or 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
# https://en.bitcoin.it/wiki/Proof_of_work | |
# usage: ProofOfWork.new("Hello World!", 3).nonce_and_hash | |
# In this example think of the "Hello World!" as a a collection of Bitcoin transactions waiting to be verified. | |
# 3 is the arbitary number that makes it harder to verify the transactions. Over time 3 goes up and up and the | |
# difficulty is exponential. | |
require 'digest' |
This file contains hidden or 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
➜ tmp cat no_way.rb | |
def ☃ | |
puts "Oh look, it's a ☃" | |
end | |
☃ | |
➜ tmp ruby no_way.rb | |
Oh look, it's a ☃ | |
➜ tmp |
This file contains hidden or 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
" Vundle Setup | |
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! | |
Bundle 'gmarik/vundle' |
This file contains hidden or 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
project_path='~/apps/'$app'/current' | |
frontend_path=$project_path$subdir | |
cmd='' | |
cmd+='. ~/.bash_profile;' | |
cmd+='cd '$project_path';' | |
cmd+='git pull;' | |
cmd+='kill `cat '$frontend_path'/tmp/pids/unicorn.pid`;' | |
sleep 5 |
This file contains hidden or 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
# install by getting the raw url from the github interface and run something like.. | |
# curl -L https//gist.github.com/blahblah | bash | |
mkdir -p ~/backups | |
mkdir -p ~/bin | |
# a backup for each day of the month overwritting old days | |
echo "mysqldump -u root --all-databases > ~/backups/all-`date +20XX-XX-%d`.sql" > ~/bin/backup_all_mysql_databases | |
chmod 777 ~/bin/backup_all_mysql_databases |