Skip to content

Instantly share code, notes, and snippets.

View scottstanfield's full-sized avatar
🚀
:wq

Scott Stanfield scottstanfield

🚀
:wq
  • Relativity Space
  • California
  • 17:28 (UTC -07:00)
View GitHub Profile
@seth-brown
seth-brown / ba-top-breweries.hs
Created December 13, 2014 21:45
Breweries with the most beers in Beer Advocates 250 list
{- Seth Brown
2014-12-13
GHC 7.8.3
sethbrown AT drbunsen DOT ORG
Copyright 2014 Seth Brown. All rights reserved.
data from: http://www.beeradvocate.com/lists/top/
$ runghc ba-top-breweries.hs < data.txt
======================================
Hill Farmstead Brewery,24
@icecreammatt
icecreammatt / ip-lookup.service
Last active August 29, 2015 14:18
Systemd Unit file for docker
[Unit]
Description=IP Lookup
After=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker kill lookup
ExecStartPre=-/usr/bin/docker rm lookup
ExecStartPre=-/usr/bin/docker pull icecreammatt/lookup
@icecreammatt
icecreammatt / coreos-cloud-config
Last active August 29, 2015 14:18
CoreOS Cloud-config
#cloud-config
coreos:
update:
reboot-strategy: off
etcd:
discovery: https://discovery.etcd.io/<token>
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
@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
@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",
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
@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/'
@kvelleby
kvelleby / gist:9392878
Created March 6, 2014 15:59
R: Regression models
# Regression models
lm(y ~ x, data=df)
glm(y ~ x, data=df, family=binomial(link="logit"))
glm(y ~ x, data=df, family=binomial(link="probit"))
glm(y ~ x, data=df, family=poisson(link="log"))
library(MASS)
glm.nb(y ~ x, data=df)
# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# Next, we download packages that H2O depends on.
if (! ("methods" %in% rownames(installed.packages()))) { install.packages("methods") }
if (! ("statmod" %in% rownames(installed.packages()))) { install.packages("statmod") }
if (! ("stats" %in% rownames(installed.packages()))) { install.packages("stats") }
if (! ("graphics" %in% rownames(installed.packages()))) { install.packages("graphics") }
if (! ("RCurl" %in% rownames(installed.packages()))) { install.packages("RCurl") }