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
# dedup.jl | |
# wrapper around Apache PDFBox (https://pdfbox.apache.org/) | |
# for removing duplicate pages from a PDF | |
# only tested on macOS | |
JAR = "pdfbox-app-2.0.17.jar" | |
pdfbox(args...) = run(`java -jar $JAR $args`) | |
numpages(pdf) = parse(Int, read( |
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 Data.Maybe | |
import Data.Char | |
import Data.List | |
layout :: [(Char, String)] | |
layout = [ ('Q', "WAS"), ('W', "QASE"), ('E', "WSDR"), ('R', "EDFT"), ('T', "RFGY"), ('Y', "TGHU") | |
,('U', "YHJI"), ('I', "UJKO"), ('O', "IKLP"), ('P', "OL"), ('A', "QWSZ"), ('S', "AZWEDCX") | |
,('D', "ERFCXS"), ('F', "RTGVCD"), ('G', "TYHBVF"), ('H', "YUJNBG"), ('J', "HUIKMN") | |
,('K', "JIOL"), ('L', "KOP"), ('Z', "ASX"), ('X', "ZSDC"), ('C', "XDFV"), ('V', "CFGB") | |
,('B', "VGHN"), ('N', "BHJM"), ('M', "NJK")] |
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
# wallpaper.py | |
# Sets the desktop background to the album art of the current track the user is listening to on lastfm. | |
import json | |
import urllib | |
import urllib2 | |
import subprocess | |
import re | |
import time | |
import cv2 |
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
if (player == PLAYER_ONE) { | |
player = PLAYER_ONE; | |
} else if (player == PLAYER_TWO) { | |
player = PLAYER_TWO; | |
} else { | |
player = PLAYER_THREE; | |
} |
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 Data.List | |
alphaWrap :: Char -> Char | |
alphaWrap c | |
| c == 'z' = 'a' | |
| 'a' <= c && c < 'z' = succ c | |
| otherwise = '?' | |
cycleLength :: Eq a => (a -> a) -> a -> Int | |
cycleLength f x = last $ 1 : unfoldr (cycleLength' f) (1, 1, x, f x) |
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
{- | |
DivisibilityGraph.hs | |
Uses Graphviz http://www.graphviz.org/ and the haskell library http://projects.haskell.org/graphviz/ | |
to draw divisibility graphs for numbers. | |
To install the haskell package just use | |
$ cabal install graphviz |
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 Data.Complex | |
import Control.Arrow | |
import Control.Monad | |
fft :: [Complex Double] -> [Complex Double] | |
fft = fft' . pad | |
-- perform a fast fourier transform | |
fft' :: [Complex Double] -> [Complex Double] | |
fft' [x] = [x] |