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
# Check this out, rvm use rbx | |
ruby_block "rvm use rbx" do | |
block do | |
Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e| | |
o.each_line do |line| | |
env_bits = line.split("=") | |
ENV[env_bits[0]] = env_bits[1] | |
end | |
end |
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/ruby | |
require 'rubygems' | |
require 'fog' | |
# Credentials in ./config.rb | |
require "./config.rb" | |
# Set up a connection | |
connection = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => @aws_access_key_id, | |
:aws_secret_access_key => @aws_secret_access_key) |
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
require 'rubygems' | |
require 'sequel' | |
require 'fileutils' | |
require 'cgi' | |
# NOTE: This converter requires Sequel and the MySQL gems. | |
# The MySQL gem can be difficult to install on OS X. Once you have MySQL | |
# installed, running the following commands should work: | |
# $ sudo gem install sequel | |
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config |
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
# source: Jan Aerts http://saaientist.blogspot.com/2009/01/threads-in-ruby-probably-not-how-to-use.html | |
require 'rubygems' | |
require 'progressbar' | |
MAX_NR_OF_THREADS = 5 | |
nr_of_lines = `wc -l input_file.tsv`.split(/ /)[0].to_i | |
pbar = ProgressBar.new('processing', nr_of_lines.to_f/MAX_NR_OF_THREADS) | |
File.open(input_file.tsv).each_slice(MAX_NR_OF_THREADS) do |slice| | |
pbar.inc |
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/ruby | |
require "rubygems" | |
require "mongo" | |
require "json/pure" | |
require "open-uri" | |
# db config | |
db = Mongo::Connection.new.db('friendfeed') | |
col = db.collection('lifesci') |
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
#!/bin/bash -xe | |
# Run this script from machine with the credintials and the latest api tools installed | |
EBS_DEVICE='/dev/sdh' | |
INSTANCE_ID=$1 | |
AKI='aki-5f15f636' | |
ARI='ari-0915f660' | |
NAME=${2:-`date "+%Y-%m-%d-%H-%M"`} |
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/ruby | |
# from http://travis-whitton.blogspot.com/2009/10/crushing-pngs-with-ruby.html | |
# usage crush.rb images | sh | |
require 'fileutils' | |
require 'find' | |
input_dir = ARGV[0] | |
rewrite_dir = "/tmp/crush/" |
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
(ns examples.fs | |
(:import | |
(org.apache.log4j Level Logger) | |
(java.io BufferedReader InputStream InputStreamReader)) | |
(:use [clojure.contrib.test-is :only (deftest is)]) | |
(:use [clojure.contrib.except :only (throwf throw-arg)]) | |
(:require [clojure.contrib.duck-streams :as ds] | |
[examples.imports :as import])) |
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
(ns examples.fs | |
(:import | |
(org.apache.log4j Level Logger) | |
(java.io BufferedReader InputStream InputStreamReader)) | |
(:use [clojure.contrib.test-is :only (deftest is)]) | |
(:use [clojure.contrib.except :only (throwf throw-arg)]) | |
(:require [clojure.contrib.duck-streams :as ds] | |
[examples.imports :as import])) |
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
#!/bin/sh | |
# -*- sh -*- | |
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home | |
export PATH=$JAVA_HOME/bin:$PATH | |
CLJ=$HOME/Projects/clj/clojure | |
java \ | |
-server \ |