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
class Fixnum | |
def minutes | |
self * 60 | |
end | |
def days | |
self * 60 * 60 * 24 | |
end | |
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
alias monitor='while true; do if [ "$(wget -T 10 -t 1 https://some.server.com -O /dev/null -o /dev/stdout | grep 200.OK)" = "" ]; then "$(..restart...)"; echo "restarted at `date`"; fi; echo "last checked at `date`"; sleep 1800; 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
# usage: | |
# sedr 100 120 some/file/with.txt hot | |
# will return lines 100 to 120 of some/file/with.txt with 'hot' in green | |
# | |
alias sedr='ruby -e "start=ARGV.shift;finish=ARGV.shift;filename=ARGV.shift;word=ARGV.shift;cmd=%Q(sed -n #{start},#{finish}p #{filename});cmd << %Q( | sed ''/#{word}/s//`printf "\033[32m#{word}\033[0m"`/'') unless word.nil?; puts cmd; puts %x[#{cmd}];"' |
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
alias s:merge='ruby -e "branch=ARGV.shift;ARGV.each{|r| cmd=%Q(svn merge https://subversion/svn/repo/#{branch} -c #{r}); puts cmd}"' | |
alias s:merge:live='ruby -e "branch=ARGV.shift;ARGV.each{|r| cmd=%Q(svn merge https://subversion/svn/repo/#{branch} -c #{r}); system(cmd)}"' | |
alias s:merge:dry='ruby -e "branch=ARGV.shift;ARGV.each{|r| cmd=%Q(svn merge https://subversion.looksmart.com/svn/plp/amp/#{branch} -> | |
# mergr branches/branch 123 124 125 ... |
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
Gem::Specification.new do |s| | |
s.name = 'multi_methods' | |
s.version = '1.0.3' | |
s.platform = Gem::Platform::RUBY | |
s.author = 'Brian Kierstead' | |
s.email = '[email protected]' | |
s.summary = 'General dispatch for ruby' | |
s.description = <<EOS | |
Supports general dispatch using clojure style multi-methods. This can be used | |
for anything from basic function overloading to a function dispatch based on arbitrary complexity. Based on the work of Andrew Garson (https://github.com/andrewGarson/ruby-multimethods) and Paul Santa Clara (https://github.com/psantacl/ruby-multimethods) |
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
# Add to ~/.bash_profile | |
# Start/Reuse SSH Agent - restart or re-use an existing agent | |
SSH_AGENT_CACHE=/tmp/ssh_agent_eval_`whoami` | |
if [ -s "${SSH_AGENT_CACHE}" ] | |
then | |
echo "Reusing existing ssh-agent" | |
eval `cat "${SSH_AGENT_CACHE}"` | |
# Check that agent still exists |
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
# blog post: http://blog.slashpoundbang.com/post/1455548868/memcachemodel-make-any-ruby-object-that-persists-in | |
# No transactions or exceptions (yet). | |
module MemcacheModel | |
def self.included(base) | |
base.class_eval do | |
extend ActiveModel::Naming | |
extend ActiveModel::Translation | |
extend ActiveModel::Callbacks | |
extend MemcacheModel::ClassMethods |
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
// from ruby-1.8.7-p357 ruby.h | |
#define RBIGNUM_SET_SIGN(b,s) (RBIGNUM(b)->sign = (s)) // line 455 | |
#define RBIGNUM_LEN(b) (RBIGNUM(b)->len) // line 458 |
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
mkdir -p .ext/common | |
make PRELIBS='-Wl,-rpath,/home/bkierstead/rubies/ruby-enterprise-1.8.7-2009.10/lib -L/home/bkierstead/rubies/ruby-enterprise-1.8.7-2009.10/lib -ltcmalloc_minimal ' | |
gcc -g -Os -fno-strict-aliasing -DRUBY_EXPORT -D_GNU_SOURCE=1 -L. -rdynamic -Wl,-export-dynamic main.o libruby-static.a -Wl,-rpath,/home/bkierstead/rubies/ruby-enterprise-1.8.7-2009.10/lib -L/home/bkierstead/rubies/ruby-enterprise-1.8.7-2009.10/lib -ltcmalloc_minimal -lrt -ldl -lcrypt -lm -o miniruby | |
libruby-static.a(random.o): In function `make_seed_value': | |
/home/bkierstead/src/ruby-enterprise-1.8.7-2009.10/source/random.c:304: undefined reference to `RBIGNUM_SET_SIGN' | |
/home/bkierstead/src/ruby-enterprise-1.8.7-2009.10/source/random.c:313: undefined reference to `RBIGNUM_LEN' | |
/home/bkierstead/src/ruby-enterprise-1.8.7-2009.10/source/random.c:313: undefined reference to `RBIGNUM_LEN' | |
collect2: ld returned 1 exit status | |
make: *** [miniruby] Error 1 |
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
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */ | |
/* static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */ | |
#include "config.h" | |
#include "defines.h" | |
#include <stdio.h> | |
#ifdef HAVE_STDLIB_H | |
#include <stdlib.h> | |
#endif |
NewerOlder