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
# zsh function | |
svnhistgrep () { | |
term=$1 | |
file=$2 | |
versions=($(svn log $file | perl -ne 'print "$1 " if (/r(\d+)/)')) | |
for r in $versions | |
do | |
echo "$file r$r" | |
svn cat -r$r $file | egrep -C 3 -n $term | |
done |
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
# my scm related aliases | |
export clrsvn='sed \ | |
-e "s/^\? \(.*\)/$(tput setaf 243) [?] \1$NC/" \ | |
-e "s/^A \(.*\)/$(tput setaf 02) [A] \1$NC/" \ | |
-e "s/^C \(.*\)/$(tput setaf 200) [C] \1$NC/" \ | |
-e "s/^D \(.*\)/$(tput setaf 01) [D] \1$NC/" \ | |
-e "s/^I \(.*\)/$(tput setaf 238) [I] \1$NC/" \ | |
-e "s/^! \(.*\)/$(tput setaf 09) [!] \1$NC/" \ | |
-e "s/^G \(.*\)/$(tput setaf 214) [G] \1$NC/" \ | |
-e "s/^M \(.*\)/$(tput setaf 11) [M] \1$NC/" \ |
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/ruby | |
# | |
# little ftps with tls to rss utility | |
# makes a connection, lists the contents of the | |
# directory and produces an rss feed of the results. | |
# | |
# config in our home directory ~/.ftprss | |
# example: | |
# :host: ftp.example.com | |
# :user: username |
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/ruby | |
# encoding: utf-8 | |
# | |
# filter to colorize output | |
# | |
# cat file | highlight aaa bbb cc | |
# | |
# aaa,bbb,ccc all get assigned different colors and are highlighted in the output | |
# |
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
# a capistrano task to list tasks by role. | |
namespace :list do | |
desc "list tasks by role" | |
task :by_role do | |
tasks = top.task_list(:all) | |
set(:verbose, false) unless exists?(:verbose) | |
unless verbose | |
tasks = tasks.reject { |t| t.description.empty? || t.description =~ /^\[internal\]/ } | |
end |
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 perl | |
# | |
# A job run submission script for | |
# Jenkins (http://jenkins-ci.org/) | |
# | |
# Your command will run regardless of if the jenkins server is up or | |
# not. However there is no buffering so if your jenkins server is not | |
# up when the task completes then the run won't be recorded. | |
# |
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 | |
# encoding: utf-8 | |
# | |
# Reverse engineer ActiveRecord definitions | |
# by examining an existing database. | |
# | |
# This is mysql spesific at the moment. | |
# | |
# % active_record_by_inference -h | |
# Usage: active_record_by_inference.rb [options] [table] [table] ... |
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
# | |
# a coffeescript port of http://processing.org/learning/topics/bouncybubbles.html | |
# | |
ids = 0 | |
spring = 0.02 | |
gravity = 0.01 | |
friction = -0.2 | |
force_field = 1.5 | |
balls = [] |
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/bash -x | |
rvm install 1.9.3-head | |
rvm use 1.9.3-head | |
rvm gemset create rails31 | |
rvm use 1.9.3-head@rails31 | |
gem install bundler rails | |
rails new rest_api |
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
def sum_by(arr_hash, value_key, group_key=nil, &block) | |
if group_key.instance_of? Proc | |
block = group_key | |
group_key = nil | |
end | |
arr_hash.inject({}) do |sums, row| | |
group_key = (block_given?) ? block.call(row) : group_key | |
sums[group_key] ||= 0.0 | |
sums[group_key] += row[value_key] || 0.0 | |
sums |
OlderNewer