This file contains 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 'date' | |
require 'rexml/document' | |
include REXML # so that we don't have to prefix everything with REXML::... | |
blogger_id = "111111111111" | |
blog_title = "my blog" | |
author_name = "my name" | |
author_email = "noreply@blogger.com" | |
blog_id = "222222222222222" |
This file contains 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 'oauth' | |
require 'oauth/client' | |
require 'oauth/token' | |
require 'oauth/consumer' | |
require 'activeresource' | |
require 'pp' | |
module OAuth | |
module Rails |
This file contains 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 | |
# Simple lighthouse export | |
require 'lib/lighthouse' | |
include Lighthouse | |
Lighthouse.account = "sml" | |
#### You can use `authenticate` OR `token` |
This file contains 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
# TB usage at which pricing changes | |
s3_tiers = %w{50 100 500 1000 5000 1000000000}.collect {|x| x.to_f} | |
# Cost per GB/month for each of the above tiers | |
s3 = %w{0.15 0.14 0.13 0.105 0.08 0.055}.collect {|x| x.to_f} | |
s3_reduced = %w{0.1 0.093 0.087 0.07 0.053 0.037}.collect {|x| x.to_f} | |
# ebs is always 0.10/GB per month | |
ebs = %w{0.1 0.1 0.1 0.1 0.1 0.1}.collect {|x| x.to_f} |
This file contains 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 | |
# Sets up auto-tracking of a remote branch with same base name. | |
# Can set up "git track" so it feels built-in: | |
# git config --global --add alias.track '!git-track' | |
# | |
branch=$(git branch 2>/dev/null | grep ^\*) | |
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /} | |
git config branch.$tracking.remote origin |
This file contains 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
# origin of work | |
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://posterous.timocracy.com/the-trouble-with-bash-colored-prompts-munging | |
function parse_git_dirty { | |
status=`git status 2> /dev/null` | |
bits='' | |
if [[ "${status}" =~ "Changed but not updated" ]]; then | |
bits="${bits}*" | |
fi |
This file contains 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 'tmpdir' | |
require 'fileutils' | |
# scope bundling for this script to a directory based on its path | |
tmpdir = "#{Dir.tmpdir}/script_bundler/#{File.expand_path(__FILE__).gsub(/\W+/, '_')}" | |
FileUtils.mkdir_p(tmpdir) | |
gemfile = "#{tmpdir}/Gemfile" | |
gemfile_lock = "#{gemfile}.lock" |
This file contains 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 | |
# Add your gems here | |
# | |
gemfile_contents = <<-EOF | |
source "http://rubygems.org" | |
gem 'clamp' | |
gem 'iniparse' | |
gem 'rest-client' | |
gem 'json' |
This file contains 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 | |
# Add your gems here | |
# | |
gemfile_contents = <<-EOF | |
source "http://rubygems.org" | |
gem "fog" | |
gem "yajl-ruby" | |
EOF |
This file contains 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 | |
rss = '.+?Rss:\s+(\d+)' | |
share = '.+?Shared_Clean:\s+(\d+)' | |
share << '.+?Shared_Dirty:\s+(\d+)' | |
priv = '.+?Private_Clean:\s+(\d+)' | |
priv << '.+?Private_Dirty:\s+(\d+)' | |
MEM_REGEXP = /\[heap\]#{rss}#{share}#{priv}/m | |
def mem_usage_linux |
OlderNewer