Skip to content

Instantly share code, notes, and snippets.

View kisom's full-sized avatar

Kyle Isom kisom

View GitHub Profile
@kisom
kisom / Monads.lhs
Last active August 29, 2015 14:09
Source file for the monad post.
(This post is a Literate Haskell file that was run through pandoc to
produce markdown).
It seems customary in the Haskell space to write an introduction to
monads; my attempt in this exposition is not to outdo anyone else, but
to make the topic clear enough that I can write about it. My hope is
that by doing so, it becomes more clear to me.
> module Perhaps where
@kisom
kisom / Purity.lhs
Last active May 31, 2016 13:00
"Why Purity Matters" blog post.
Purity is a useful construct that forces programmers to consider that the
environment that they are operating in is unclean, and this introduces
barriers to formally defining the behaviour of the system comprising
the program and its environment.
This file is a [literate Haskell
file](https://gist.github.com/kisom/3863f17636d99b4f8401) run through
[pandoc](http://johnmacfarlane.net/pandoc/) to produce a Markdown
post. There might be a few glitches as I'm still developing a workflow
in this style.
@kisom
kisom / count-macroexpansions.lisp
Created April 7, 2015 22:28
Fun little function to count the number of times a macro gets expanded.
(defun count-macroexpansions (form)
(labels ((count-expansions (form n)
(multiple-value-bind
(expansion expanded)
(macroexpand-1 form)
(if expanded
(count-expansions expansion (+ n 1))
n))))
(count-expansions form 0)))
#!/bin/sh
# convert Nikon NEF RAW images to FITS.
#
# depends on dcraw and imagemagick:
# apt-get install dcraw imagemagick
IMAGE_LIST="$1"
if [ -z "$IMAGE_LIST" ]
then
ATTRS{idVendor}=="5332", ATTRS{idProduct}=="1300", ACTION=="add", SUBSYSTEM=="usb", ATTR{power/control}="on"
;; -*-lisp-*-
;; Load swank.
;; *prefix-key* ; swank will kick this off
(ql:quickload :swank)
(ql:quickload :manifest)
(defvar *manifest-url*
(manifest:start))
> import Control.Applicative
This post is a [literate
Haskell](https://gist.github.com/kisom/09e471e145bf1eca9124) file,
converted to org-mode with [Pandoc](http://pandoc.org).
Time to explore the `Applicative` type.
First, `fmap`:
@kisom
kisom / README.md
Created August 14, 2015 23:00
Auto fmt / vet / build / test Go code

This is my workflow for automatically building and testing Go code. It uses steeloverseer to watch for changes to the tree and run the standard Go tools (vet, build, test) on the package as well as golint on any changed files.

Install steeloverseer with

cabal install steeloverseer && cp ~/.cabal/bin/sos ~/bin
@kisom
kisom / README
Last active September 13, 2015 08:04
cd
Written as a demo of how a shell would implement this, and why it needs
to be a shell builtin.
This won't actually work as a standalone program; chdir(3) only changes
the directory of the current process. As soon as the program exits, it
returns control to the parent process (the shell). If this is executed
as a shell builtin, the shell process's working directory is changed.
@kisom
kisom / output.sh
Last active September 15, 2015 04:21
scanning elvi
~/code/perl
(0) <tessier:kyle> $ perl scan-elvi.pl
w3link doesn't match.
l1sp doesn't match.
w3rdf doesn't match.
w3html doesn't match.
worldwidescience doesn't match.
searx doesn't match.
w3css doesn't match.
f5 doesn't match.