Skip to content

Instantly share code, notes, and snippets.

View sordina's full-sized avatar

Lyndon Maydwell sordina

View GitHub Profile
#!/bin/bash
set -e
# source $HOME/.google/api_keys
USER="$1"
if [ ! "$USER" ]
then
{-# Language MultiParamTypeClasses, FunctionalDependencies #-}
module Sort
( windowSort
, Windowed(..)
)
where
@sordina
sordina / freer.hs
Created January 28, 2016 10:56
Excerpts from Oleg's Freer Monads - http://okmij.org/ftp/Haskell/extensible/more.pdf
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeOperators #-}
import Control.Monad
{-
-- Sampler V2
import Data.Time.Clock.POSIX
import Control.Monad
import System.Environment
import System.IO
import System.Exit
import Text.Read
#!/bin/bash
if [ -f .dockername ]
then
N=$(cat .dockername)
else
N=$(basename $(pwd))-$$
echo $N > .dockername
fi
#!/bin/bash
SUBREDDIT=${SUBREDDIT-"$1"}
OUTDIR=${OUTDIR-"/tmp/subreddit-posts/$SUBREDDIT/$$"}
OUTALL="${OUTDIR}/postset-all.json"
if [ ! "$SUBREDDIT" ]
then
echo "Must Define SUBREDDIT"
exit 1
#!/usr/bin/env python
import matplotlib as plt
import pandas as pd
import sys
import os
outname = "/tmp/plot-columns-{}.png".format(os.getpid())
infile = None
{-# LANGUAGE FlexibleContexts #-}
import Lens.Micro
import Lens.Micro.Mtl
import Lens.Micro.Internal
import Control.Applicative
loebl :: Each s a (a -> b) b => s -> a
loebl x = go where go = over each ($ go) x
@sordina
sordina / migrate.sh
Last active November 18, 2015 22:56
Advanced Migration Framework
#!/bin/sh
set -e
# Options with defaults
SCRIPT_ARGS="$*"
MIGRATION_DIR=${MIGRATION_DIR-'migrations'}
MIGRATION_TABLE=${MIGRATION_TABLE-'migrations'}
MIGRATION_COMMAND=${MIGRATION_COMMAND-'psql'}
-- Clustering algorithm v2
destroy _ E = E
destroy 1 (L _) = E
destroy _ (L x) = L x
destroy n x@(N l r) | count x == n = E
| count x > n = N (destroy n l) (destroy n r)
| otherwise = x
search _ E = []