Skip to content

Instantly share code, notes, and snippets.

agum onkey agumonkey

  • NONE
  • Dark side of the moon @ ['tkf8-2-1', 'ay21-3', '3263-827']
Block or report user

Report or block agumonkey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:8840621

I like LYAH as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell: 80% completion here is fine if you feel your attention waning, the next thing will address hammering in things like functors and monads via typeclasses. this will hammer in the lessons in a very direct form by forcing you to confront the challenges and lessons learned by the creators and community of Haskell itself. Doing the exercises here is critical for being fluent.

Real World Haskell is available online. I recommend it as a reference only.

agumonkey / journald.conf
Created Mar 23, 2014
push events log to a tty
View journald.conf
agumonkey / pharen_lexical_scope_bug.phn
Created Mar 24, 2014
compiler seems to lift inner HOF too early, binding with top level values
View pharen_lexical_scope_bug.phn
(fn rev (l)
"[a] -> [a]"
(fn aux (l a)
(if (empty? l)
(aux (rest l) (cons (first l) a))))
(aux l []))
;; (rev [])
;; (rev [1 2 3])
import sh
from operator import itemgetter
ids = [0,3,4,-1]
fns = [fn.strip().split(' ') for fn in"-lahrtX",_iter=True)][1:]
[itemgetter(*ids)(fn) for fn in fns]
View gist:807a6b1fe188104d6460
import json
import requests
agumonkey / insert-xsel.el
Created Jun 2, 2014
Little elisp wrapper around `xsel`
View insert-xsel.el
(defun insert-xsel ()
(with-current-buffer (current-buffer)
;; (insert (shell-command-to-string "xsel")))) ;; also hangs some times
(insert (shell-command-to-string "xsel -o -t 10 -p"))))
agumonkey / templicate.el
Created Jun 30, 2014
virtual pseudo code for a simple differential line duplicator, turning some parts of the previous line as placeholders in a temporary yasnippet
View templicate.el
(defun templicate ()
"duplicate the current line as a temporary
snippet to be filled on the fly.
(let ((line (current-line))
(placeholders (select-many "word:"))
(template (mk-yasnippet-from-string line placeholders)))
agumonkey / python-mode-newdef.el
Created Aug 3, 2014
Fast function addition: Jumps below the current defun, from anywhere inside it, at the same indentation level
View python-mode-newdef.el
(defun python/find-relative-indentation ()
"find the previous defun indent level"
(with-current-buffer (current-buffer)
(let* ((previous-def (progn (search-backward "def ") (point)))
(previous-bol (progn (beginning-of-line) (point)))
(indent (- previous-def previous-bol)))
;; def foo():
agumonkey / functor.el
Created Aug 10, 2014
Everything is a function ? even structs and types ?
View functor.el
(setq lexical-binding t)
(defun make-struct (fields)
(lambda (values)
(let ((map (-zip fields values)))
(lambda (field)
(assoc field map)))))
;;; generic
(setq s (make-struct '(:a :b :c)))
agumonkey /
Created Sep 27, 2014
attempt to recreate config [key = value] file loader with comments and more
def load(c):
d = {}
with open(c) as cnf:
for l in cnf.readlines():
if not l.startswith('#'):
k,v = l.split('=',1)
d[k] = v.strip()
if l.startswith('##'):
instr = l[2:]
You can’t perform that action at this time.