Skip to content

Instantly share code, notes, and snippets.

#!/usr/local/bin/perl
undef$/;$_=<DATA>;y/ODA\n / /ds;@yoda=map{length}split;print chr
oct join('',splice(@yoda,0,3))-111 while@yoda;
__DATA__
00O00O000O00O0000 000O DD000000O0
0DO0000000O0000O00 O00000 00O00000O0O
0000 0O0 O00 O00 00D 0DO
00O0 0O0 00D 000 DO0D00000D
0O00 DOD 000000O00000 000 O00O
#!/usr/local/bin/perl
$ _=
qq
.CG
T--A
A---T
A----T
C----G
T----A
# this is an example migration template for you to tweak
# it is assumed that this file will be located in script/migrations
require File.expand_path('../../../config/environment', __FILE__)
class ExampleMigration < Migrations::KatamaMigration
# you can use DateTime.now.to_i
@@db_version = 1234567890
def up
class ChangeCalculator
QUARTER = 0.25
DIME = 0.10
NICKEL = 0.05
PENNY = 0.01
COINS = [QUARTER, DIME, NICKEL, PENNY]
def calculate(x)
remaining = x
$h = COINS.inject({}) do |hash, coin|
require 'cgi'
require 'open-uri'
class TorrentManager
def initialize
# configuration options
@list_file = "torrents.txt"
@watch_dir = File.expand_path "~/watch"
@dmerrick
dmerrick / update_json_for_nagios.rb
Created March 8, 2012 16:43
tool for adding required json attributes to add hosts to nagios
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'pp' if $DEBUG
class UpdateJsonForNagios
KNIFE_CONFIG = "~/work/chef/.chef/knife.rb"
#!/bin/bash
set -x # print every command before it runs
set -e # exit if any command fails
mkdir -p /tmp/katama_chef/
git checkout katama_chef
cp -r cookbooks/$1 /tmp/katama_chef/
mkdir -p /tmp/hc_production/
bash -c '
# removed installation, presumably Chef is installed on existing nodes
# adapted by Dana from the migration linked to from this document:
# http://wiki.opscode.com/display/chef/Migrating+to+Hosted+Chef+from+an+Open+Source+Chef+Server+implementation
mv /etc/chef/client.pem{,.old_chef_server}
mv /etc/chef/validation.pem{,.old_chef_server}
(
#!/usr/bin/env ruby -w
require 'open-uri'
require 'digest/md5'
require 'fileutils'
# this script creates a gif from NASA's high-res images of the sun
# the goal is to capture the transit of Venus in gif form
# it is expected that this will be run on OS X
# the following are required:
@dmerrick
dmerrick / stream_favorites_combiner.rb
Created October 5, 2012 18:19
team liquid streams
#!/usr/bin/env ruby
require 'pp'
old_list = [
"AcerMMA",
"Artosis",
"Blizzard Stream",
"Day[9].tv",
"Destiny",
"Dragon",