Skip to content

Instantly share code, notes, and snippets.


Rowan rjkat

View GitHub Profile
rjkat / dedup.jl
Created Nov 30, 2019
remove duplicate pages from a PDF
View dedup.jl
# dedup.jl
# wrapper around Apache PDFBox (
# 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(
View Keyboard.hs
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")]
# 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
View gist:2970101
if (player == PLAYER_ONE) {
player = PLAYER_ONE;
} else if (player == PLAYER_TWO) {
player = PLAYER_TWO;
} else {
player = PLAYER_THREE;
rjkat / Cycle.hs
Created Jun 3, 2012
Uses Brent's Algorithm to compute the cycle length and offset of a function
View Cycle.hs
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)
rjkat / DivisibilityGraph.hs
Last active Oct 4, 2015
Divisibility Graph
View DivisibilityGraph.hs
Uses Graphviz and the haskell library
to draw divisibility graphs for numbers.
To install the haskell package just use
$ cabal install graphviz
rjkat / FFT.hs
Created Apr 9, 2012
Haskell Fast Fourier Transform
View FFT.hs
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]
You can’t perform that action at this time.