Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / gist:734122
Created December 8, 2010 23:39
~/projects/jruby ➔ jmap -histo 19907 | grep rubyobj | head -50
116: 1945 46680 rubyobj.Gem.Version
118: 1898 45552 rubyobj.Gem.Version
120: 1826 43824 rubyobj.Gem.Requirement
123: 1804 43296 rubyobj.Gem.Requirement
158: 914 21936 rubyobj.Gem.Dependency
166: 876 21024 rubyobj.Gem.Dependency
209: 463 11112 rubyobj.Gem.Specification
211: 455 10920 rubyobj.Gem.Specification
319: 142 3408 rubyobj.ActiveSupport.TimeZone
@mja
mja / homebrew_scipy.sh
Created December 13, 2010 08:09
Install numpy, scipy, and matplotlib on OS X 10.6
homebrew install gfortran
homebrew install python
homebrew install distribute
homebrew install pip
pip install ipython
pip install numpy
pip install scipy
pip install -f http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0/matplotlib-1.0.0.tar.gz matplotlib
@sunilnandihalli
sunilnandihalli / curry.clj
Created December 17, 2010 20:33
a macro to create fixed-arity curryable function in clojure
(defmacro def-curry-fn [name args & body]
{:pre [(not-any? #{'&} args)]}
(if (empty? args)
`(defn ~name ~args ~@body)
(let [rec-funcs (reduce (fn [l v]
`(letfn [(helper#
([] helper#)
([x#] (let [~v x#] ~l))
([x# & rest#] (let [~v x#]
(apply (helper# x#) rest#))))]
@rlm
rlm / classpath_utils.clj
Created January 12, 2011 03:03
export_files.clj
(ns rlm.classpath-utils
(:require [clojure.contrib [duck-streams :as ds]])
(:use [clojure.contrib java-utils]))
(defn classpath []
(get-system-property "java.class.path"))
(defn add-to-classpath [file-name]
# Install ZeroMQ
sudo brew install zmq
easy_install pyzmq
[0] http://www.zeromq.org/bindings:python
# Install OpenCV
sudo brew install opencv
# I want this method in ruby-core
def let
yield
end
def fib(i)
let do |n = 1, result = 0|
if i == -1
result
else
@dbrady
dbrady / change_case.el
Created February 28, 2011 01:02
emacs lisp defuns to change the case (camelCase <-> snake_case) of the word under cursor, or an entire region if selected. NOTE: the snake-case defuns do not work, they just camelCase. Ooops.
;; Grateful thanks are given to Brian Marick (@marick) for helping me
;; write these. I got the original idea while reading through
;; http://xahlee.org/emacs/elisp_idioms.html, but couldn't work out
;; the elisp regexes. Brian Marick (@marick) stepped in and helped. He
;; took my tortured and broken camelcase-region and turned it into
;; something that actually worked. I then created
;; camelcase-word-or-region. I then wrote the snakecase versions but I
;; see now that all I did was copy the camelcase defuns over and,
;; meaning to go back and finish them Real Soon Now, forgot all about
;; them. I've had a quick look (2011-02-27) but elisp regexes are
@Chouser
Chouser / proxy-star.clj
Created March 15, 2011 21:22
Like clojure.core/proxy, but accepts a syntax like reify
(let [arrays '{objects "Ljava.lang.Object;",
ints I, longs J, floats F, doubles D, chars C,
shorts S, bytes B, booleans Z}]
(defn qualify-tag [tag]
(when tag
(let [cls (if-let [array (arrays tag)]
(clojure.lang.RT/classForName (str "[" array))
(resolve tag))]
(assert (class? cls))
(symbol (pr-str cls))))))
@cowboyd
cowboyd / JenknsCI JRuby Meeting Details.mdown
Created March 28, 2011 14:28
Meeting Details for Jenkins + JRuby

JenkinsCI Ruby Plugins

Date: Every Thursday, from Thursday, January 5, 2012 to no end date Time: 10:00 am, Central Standard Time (Chicago, GMT-06:00) Meeting Number: 336 439 792 Meeting Password: (This meeting does not require a password.)

@cchandler
cchandler / gist:939951
Created April 24, 2011 22:55
glpk model for cloud vs colo costs
#Colo Server costs
set ServerTypes;
set InstanceTypes;
param CoreDemand; #How many cores do we need for a workload
param OurMoney; #The maximum upper-bound of what we're willing to spend
param ColoCostPerU; #How much are we paying per U of colocation
param Months; # How many months do we know we need this hardware