Skip to content

Instantly share code, notes, and snippets.

View sordina's full-sized avatar

Lyndon Maydwell sordina

View GitHub Profile
#include <ApplicationServices/ApplicationServices.h>
#include <unistd.h>
int main() {
// Left button down
CGEventRef click1_down = CGEventCreateMouseEvent(
NULL, kCGEventLeftMouseDown,
CGPointMake(200, 200),
kCGMouseButtonLeft
);
@sordina
sordina / gnuplot-column.bash
Created September 22, 2015 03:11
Plot a single column with gnuplot
#!/bin/bash
set -e
cat <<EOF > /tmp/gnuplot-column-script.gnuplot
set terminal png size 1600,800
set output "/tmp/gnuplot-column-$$.png"
unset key
@sordina
sordina / proxies.hs
Last active September 14, 2015 00:14
Demonstrating Data.Proxy
-- Demonstrating Data.Proxy
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Proxy
import Safe
string :: Proxy String
string = Proxy
@sordina
sordina / markov2.hs
Last active September 3, 2015 07:02
A simple Markov-Chain implementation
{-# LANGUAGE TupleSections #-}
import Data.List
import Control.Monad.Random
import Control.Arrow
import Control.Applicative
import Safe
import System.Environment
import System.Exit
import Data.Hashable (Hashable)
@sordina
sordina / stanc++.sh
Last active August 29, 2015 14:28
Compile Stan generated C++
#!/bin/bash
# Only set this variable if it isn't set
#
if [ -z ${STANHOME+x} ]
then
export STANHOME=/Users/lyndon/Downloads/cmdstan-2.7.0
echo "Setting STANHOME to $STANHOME" 1>&2
else
echo "STANHOME already set to $STANHOME" 1>&2
import Control.Monad
import Control.Applicative
import Data.Either
import Data.Monoid
instance Monoid l => Alternative (Either l) where
empty = Left mempty
Left a <|> Left _ = Left a
Left _ <|> Right b = Right b
@sordina
sordina / RandomNotes.html
Created June 17, 2015 13:15
Render random bars of notes for cello practice
<html>
<head>
<title> random notes </title>
<script type="text/javascript" charset="utf-8" src="http://www.vexflow.com/vextab/support/vexflow-min.js"> </script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
<body>
<input style="width: 800px;" id="slider" type="range" min="1" max="60" step="1" value="3" />
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RankNTypes #-}
{- mutate = set (on 0 . on 1 . on 1 . item) (* 999)
1 1
| |
@sordina
sordina / ghcm
Created April 22, 2015 05:29
Evaluate Haskell Expression and allow for module imports.
#!/bin/sh
if [[ ! "$1" ]]
then
echo 'usage: ghcm <expression> <module>*'
exit 1
fi
tmp_mod="/tmp/tmp_mod_$$.hs"
@sordina
sordina / FP-Meetup-Stats.csv
Last active August 29, 2015 14:19
functional-programming meetup stats over time
Time Groups Members Interested Cities Countries
2015/4/18 794 162489 37241 290 61
2014/12/30 706 123529 31720 272 56
2014/8/12 595 95454 25787 238 56
2014/7/9 561 88528 24047 231 56
2014/6/9 535 83638 22555 221 54
2014/4/8 488 74704 19595 213 51
2013/12/29 414 61652 15108 185 46
2013/10/26 375 65451 12770 172 42
2013/5/13 263 46007 8412 138 33