Skip to content

Instantly share code, notes, and snippets.

@seanlilmateus
seanlilmateus / gist:1360512
Created November 12, 2011 13:21
Drawing Fractal with MacRuby concurrently with Grand Central Dispatch
#!/usr/local/bin/macruby
framework 'Foundation'
framework 'Cocoa'
class Grid < NSView
attr_accessor :tiles
def initWithFrame frame
super(frame)
@tiles = []
self
@dysinger
dysinger / bootstrap.sh
Created May 13, 2011 08:27
vagrant/ec2 boostrap script
#!/bin/bash -ex
if [ ! -f /usr/bin/chef-solo ]; then
apt-get update
apt-get -y upgrade
@birkirb
birkirb / git-show-merged
Created February 28, 2011 07:29
Git show branches into which the current branch has been merged into.
#!/usr/bin/env ruby
# git-show-merged: a simple script to show you which topic branches the
# current branch has been merged into, and which it hasn't.
#
# git-show-merged Copyright 2010 Birkir A. Barkarson <birkirb@stoicviking.net>.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
@igrigorik
igrigorik / ruby-1.9-tips.rb
Created February 3, 2011 17:19
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@jdmaturen
jdmaturen / worker3.py
Created January 25, 2011 03:42
Redis stats aggregator w/ Gevent
import gevent
from gevent import monkey
monkey.patch_socket()
import hashlib
import os
import redis
# This all assumes you have the process running in
# a terminal screen and you're on Linux-like system.
# First off, suspend the process and background it
ctrl-z # suspend the process
bg # restart/continue the process in the background
# Now create files to log to. They can be called anything,
# Personally I would end the in .log. E.g. could be
# /var/logs/myprocess-stdout.log,
@zev
zev / example_aws_s3_digest_usage.txt
Created September 3, 2010 10:21
How to send the hexdigest safely in s3
S3Object.store('lambda.jpg', d, 'mybucket', :content_type => 'image/jpeg', :content_md5 => Base64.encode64(Digest::MD5.digest(d)))
#!/bin/bash
# = USAGE
# git submodule reset
function submodule_paths {
ref=$(git ls-files --error-unmatch --stage -- . | grep "^160000" | awk '{print $4}' | uniq)
echo "${ref}"
}
@defunkt
defunkt / gist:449668
Created June 23, 2010 08:55 — forked from dustin/gist:397971
Emacs Lisp to automatically add, commit, and push when files change
;; Automatically add, commit, and push when files change.
(defvar autocommit-dir-set '()
"Set of directories for which there is a pending timer job")
(defun autocommit-schedule-commit (dn)
"Schedule an autocommit (and push) if one is not already scheduled for the given dir."
(if (null (member dn autocommit-dir-set))
(progn
(run-with-idle-timer
@alexvollmer
alexvollmer / _gem
Created August 8, 2009 17:49
zsh completion for rubygems
#compdef gem gem1.9
gem_general_flags=("(-h --help)"{-h,--help}"[Get help on this command]"
"(-V --verbose)"{-V,--verbose}"[Set the verbose level of output]"
"(-q --quiet)"{-q,--quiet}"[Silence commands]"
"--config-file[Use this config file instead of default]:file:_files"
"--backtrace[Show stack backtrace on errors]"
"--debug[Turn on Ruby debugging]"
$nul_arg
)