This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jax import lax | |
import jax.numpy as jnp | |
def algdiv(a, b): | |
""" | |
The algdiv function from scipy. | |
See https://github.com/scipy/scipy/blob/c89dfc2b90d993f2a8174e57e0cbc8fbe6f3ee19/scipy/special/cdflib/algdiv.f | |
and licence https://github.com/scipy/scipy/blob/c89dfc2b90d993f2a8174e57e0cbc8fbe6f3ee19/LICENSE.txt | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prefix_in(prefs, id): | |
return any(map(lambda x: str(id).startswith(str(x)), prefs)) | |
def check_range(x,y, id): | |
l = len(str(x)) | |
trunc_id = str(id)[:l] | |
return str(x) <= trunc_id and trunc_id <= str(y) | |
def prefix_in_ranges(pref_ranges, id): | |
return any(map(lambda (x,y): check_range(x, y, id), pref_ranges)) | |
def mk_tuple(r): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def charlookup(num_chars): | |
if num_chars <= 0: | |
return ' ' | |
if num_chars <= 1: | |
return '.' | |
if num_chars <= 2: | |
return ':' | |
# if num_chars <= 3: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash/zsh git prompt support | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# This script allows you to see repository status in your prompt. | |
# | |
# To enable: | |
# | |
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=/Users/imh/.cabal/bin:$PATH | |
export PATH=/usr/local/bin:$PATH | |
export PATH=/usr/local/share/python:$PATH | |
export PYTHONPATH=/usr/local/lib/python:$PYTHONPATH | |
export ANDROID_HOME=/Users/imh/software/android/adt-bundle-mac-x86_64-20131030/sdk | |
export PATH=/Users/imh/software/android/adt-bundle-mac-x86_64-20131030/sdk/platform-tools:$PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install curl | |
apt-get install git | |
apt-get install vim | |
apt-get install haskell-platform | |
apt-get install gfortran gfortran-doc | |
apt-get install libblas libblas-dev libblas-doc | |
apt-get install liblapack liblapack-dev liblapack-doc | |
apt-get install python-virtualenv | |
apt-get install python-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
module Main where | |
import Control.Applicative | |
instance Num b => Num (a -> b) where | |
(+) = liftA2 (+) | |
(*) = liftA2 (*) | |
abs = liftA abs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'Date' | |
ABBR_DAYNAMES = {0, 'Su', 1, 'Mo', 2, 'Tu', 3, 'We', 4, 'Th', 5, 'Fr', 6, 'Sa'} | |
ABBR_MONAMES = {1, 'Jan', 2, 'Feb', 3, 'Mar', 4, 'Apr', 5, 'May', 6, 'Jun', 7, 'Jul', 8, 'Aug', 9, 'Sep', 10, 'Oct', 11, 'Nov', 12, 'Dec'} | |
def days_in_month(year, month) | |
if month < 13 then | |
if month > 0 then | |
return (Date.new(year, 12, 31) << (12 - month)).day | |
else |