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 | |
| 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/ |
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 | |
| require 'rubygems' | |
| require 'json' | |
| require 'pp' if $DEBUG | |
| class UpdateJsonForNagios | |
| KNIFE_CONFIG = "~/work/chef/.chef/knife.rb" |
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 'cgi' | |
| require 'open-uri' | |
| class TorrentManager | |
| def initialize | |
| # configuration options | |
| @list_file = "torrents.txt" | |
| @watch_dir = File.expand_path "~/watch" |
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 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| |
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
| # 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 |
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/local/bin/perl | |
| $ _= | |
| .CG | |
| T--A | |
| A---T | |
| A----T | |
| C----G | |
| T----A |
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/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 |
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 | |
| # This script fills in some of the gaps on an Engine Yard cluster deploy. | |
| # -Dana | |
| # I could probably use ARGV for this, but whatever. | |
| THIS_ENV=staging | |
| # move into our home directory | |
| cd |
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
| ------- Apache processes -------- | |
| ### Processes: 0 | |
| ### Total private dirty RSS: 0.00 MB | |
| --------- Nginx processes ---------- | |
| PID PPID VMSize Private Name | |
| ------------------------------------ |
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
| # a mixin to provide logging and nagios monitoring to cron jobs | |
| module Utils | |
| module BCMCronJob | |
| # set up the log file | |
| # we could also simply use RAILS_DEFAULT_LOGGER | |
| def before_job | |
| log_file_name = "bcm_cron.log" | |
| @log_file ||= File.open(File.join(Rails.root, 'log', log_file_name), 'a') | |