Skip to content

Instantly share code, notes, and snippets.

View AdamBrouwersHarries's full-sized avatar
🎼
Music, Dance & Maths

Adam Brouwers-Harries AdamBrouwersHarries

🎼
Music, Dance & Maths
View GitHub Profile
/**
* Created by adam on 31/05/17.
*/
package profiler
import scala.collection.mutable
import com.github.nscala_time.time.Imports._
class CheckPoint(val checkpointName: String, val startTime: org.joda.time.DateTime) {}
// NOT THREADSAFE
#!/bin/sh
# Get the final framerate for the timelapse as a command line option
FR=$1
# Create a file to hold the list of clips that we create
touch "files-$FR.txt"
# Write a header into it
echo "# $FR FPS timelapse files" > "files-$FR.txt"
# Iterate over everything in this directory
@AdamBrouwersHarries
AdamBrouwersHarries / zip_sparse_lists.py
Created December 2, 2016 14:28
zipping indexed sparse lists in python
arra = [(1.0, 0.5), (3.4, 1), (9.1, 5)]
arrb = [(0.3, 1), (2.0, 2), (4.7, 6)]
arrc = [(0.1, 2), (0.3, 3), (5.7, 7)]
arrd = [(1.1, 3), (2.1, 4), (3.3, 8)]
def index(x):
return x[0]
@AdamBrouwersHarries
AdamBrouwersHarries / infinite.hs
Created November 8, 2016 15:22
Unicode stuff in haskell
{-# LANGUAGE UnicodeSyntax #-}
module Main where
main = (∞) body 0
body :: Int -> IO Int
body i = putStrLn ("Iteration: " ++ (show i)) >> (return (i+1))
(∞) :: Monad m => (a -> m a) -> a -> m a
(∞) f x = (f x) >>= ((∞) f)

Keybase proof

I hereby claim:

  • I am adamharries on github.
  • I am adamharries (https://keybase.io/adamharries) on keybase.
  • I have a public key ASDNxzK9lh4khxUBATHymTgjiyeGzNzFjkxsaXh6A6hJbwo

To claim this, I am signing this object:

@AdamBrouwersHarries
AdamBrouwersHarries / SPLS_Jun16.md
Created June 24, 2016 13:52
Notes on talks at SPLS on 22nd June 2016

SPLS June 2016, Heriot-watt university

This quarter's SPLS was organised by Rob Stewart et al at Heriot-watt university, and presented a good balance of traditional theory heavy programming languages talks and more systems focused performance oriented talks. An overview of the talks can be found here, along with abstracts for the majority.

(Keynote) Do not believe everything you read in the papers (Tim Harris, Oracle Cambridge Labs)

The day started with a keynote from Tim Harris of Oracle Cambridge Labs, on the topic of performance evaluation for parallel algorithms and runtime system. Dr Harris opened the talk by contrasting the "ideal" state of research with reality: Ideally, you have an idea, implement it, evaluate the implementation and iterate implementing and evaluation up until the paper deadline. In reality however, what tends to happen is that the implementation phase dominates, leaving only a short amount of time to evaluate before the pap

def updatedict(fails, d, k, m):
f = fails
fc = "failcount"
f[d] = f.get(d, dict())
f[d][k] = f[d].get(k, dict())
f[d][k][m] = f[d][k].get(m, dict())
f[d][k][m][fc] = f[d][k][m].get(fc, 0) + 1
return f
@AdamBrouwersHarries
AdamBrouwersHarries / push.py
Created February 1, 2016 16:50
A small python script for pushbullet interaction from the command line. Very much based on the weebullet source, with some modifications.
#!/bin/python2
import sys
import json
import requests
apikey = "REDACTED"
def send_push(title, body):
print "Sending push. Title: [%s], body: [%s]\n" % (title, body)
apiurl = "https://api.pushbullet.com/v2/pushes"
%%MatrixMarket matrix coordinate real general
%=================================================================================
%
% This ASCII file represents a sparse MxN matrix with L
% nonzeros in the following Matrix Market format:
%
% +----------------------------------------------+
% |%%MatrixMarket matrix coordinate real general | <--- header line
% |% | <--+
% |% comments | |-- 0 or more comment lines
@AdamBrouwersHarries
AdamBrouwersHarries / arithmetic.hs
Created September 10, 2015 14:44
Super simple arithmetic expressions in haskell
{-# LANGUAGE GADTs #-}
module Main where
data Expr a where
N :: Float -> Expr Float
(:+) :: Expr Float -> Expr Float -> Expr Float
(:*) :: Expr Float -> Expr Float -> Expr Float
(:-) :: Expr Float -> Expr Float -> Expr Float
(:/) :: Expr Float -> Expr Float -> Expr Float
App :: (Float -> Float) -> Expr Float -> Expr Float