Skip to content

Instantly share code, notes, and snippets.

View scottstanfield's full-sized avatar
🚀
:wq

Scott Stanfield scottstanfield

🚀
:wq
  • Relativity Space
  • California
  • 07:28 (UTC -07:00)
View GitHub Profile
## from http://tr.im/hH5A
logsumexp <- function (x) {
y = max(x)
y + log(sum(exp(x - y)))
}
softmax <- function (x) {
exp(x - logsumexp(x))
}
@sixfeetover
sixfeetover / osx_homebrew_rvm_rails_unixodbc_sqlserver.md
Created September 4, 2010 19:49
Setup OS X 10.6.4 w/ homebrew, rvm, rails, unixodbc, freetds and SQL Server

Setup new mac from scratch

These commands are good as of 2010-11-18.

/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

Install xcode (download, or on the OS X install DVD)

http://developer.apple.com/technology/xcode.html
@akasper
akasper / bad_sort.rb
Created April 9, 2011 18:24
Coda's Sort Code
def sort(&blk)
#TODO Make this not explode
raise Exception.new("Haw, Haw!")
end
@malclocke
malclocke / gist:943565
Created April 27, 2011 01:31 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged |
awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' |
xargs git push origin --delete
@cdlm
cdlm / default.rb
Created July 17, 2011 10:44
My solarized iTerm2 + nanoc color fix + zsh syntax highlight
# patch nanoc's logging colors for solarized shinyness
#
# this is to work with the iTerm 2 color presets,
# which uses most of the "bright" color codes for the grayscale swatches
module Nanoc3::CLI
class Logger
(ACTION_COLORS ||= {}).update(
:create => "\e[38;5;2m",
:update => "\e[38;5;3m",
:identical => "\e[1;38;5;6m",
@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
class ToTextFilter < ::Nanoc3::Filter
identifier :to_text
type :binary => :text
def run(filename, params={})
File.read(filename)
end
end
class ToBinaryFilter < ::Nanoc3::Filter
identifier :to_binary
@FranklinChen
FranklinChen / WordCount.hs
Created December 8, 2011 21:16
Knuth/McIlroy word count task using Haskell
import qualified System
import qualified Data.List as List
import qualified Data.Char as Char
import qualified Data.HashMap.Strict as HashMap
main :: IO ()
main = do
[arg] <- System.getArgs
text <- getContents
let n = read arg
@andrewrcollins
andrewrcollins / trim.awk
Created January 11, 2012 04:22
ltrim(), rtrim(), and trim() in awk
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
function trim(s) { return rtrim(ltrim(s)); }
BEGIN {
# whatever
}
{
# whatever
}
END {
@scottstanfield
scottstanfield / gist:2581041
Created May 2, 2012 22:31
brew formula to compile vim with clipboard for Mac
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
# Get stable versions from hg repo instead of downloading an increasing
# number of separate patches.
url 'https://vim.googlecode.com/hg/', :revision => '70eff6af1158'
version '7.3.462'
head 'https://vim.googlecode.com/hg/'