Skip to content

Instantly share code, notes, and snippets.

View kisom's full-sized avatar

Kyle Isom kisom

View GitHub Profile
0000000000421e20 <runtime.aeshashbody>:
421e20: f3 0f 7e 02 movq (%rdx),%xmm0
421e24: 66 data16
421e25: 48 0f rex64 (bad)
421e27: 3a 22 cmp (%rdx),%ah
421e29: c1 01 66 roll $0x66,(%rcx)
421e2c: 0f 6f 14 25 a0 6b 57 movq 0x576ba0,%mm2
421e33: 00
421e34: 66 0f 6f 1c 25 b0 6b movdqa 0x576bb0,%xmm3
421e3b: 57 00
@kisom
kisom / gtgov.sh
Created August 31, 2013 18:57
Go test code coverage.
#!/bin/sh
if [ -z "$1" ]; then
PKG=$(pwd)
PKG=${PKG##${GOPATH}/src/}
else
PKG=$1
fi
OUTBASE=${PKG##*/}
SLOC=$(gofmt -comments=false $(find ${GOPATH}/src/${PKG} -iname \*.go | xargs)\
~/src/coreos-vagrant
(0) <monalisa> $ vagrant ssh
Last login: Wed Jan 15 23:47:47 UTC 2014 from 10.0.2.2 on ssh
______ ____ _____
/ ____/___ ________ / __ \/ ___/
/ / / __ \/ ___/ _ \/ / / /\__ \
/ /___/ /_/ / / / __/ /_/ /___/ /
\____/\____/_/ \___/\____//____/
core@localhost ~ $
@kisom
kisom / yolo.lisp
Created March 2, 2014 21:54
I don't even what is this has anyone ever gone so far as to even... YOLO
;;; sbcl --load yolo.lisp
;;; requires quicklisp in your .sbclrc
;;; or just load it in any other CL repl after loading quicklisp
(ql:quickload :usocket) ;; or load it some other way
;;;; some ideas:
;; echo '(defparamter *foo* 42)' | nc 127.0.0.1 4141
;; echo '(+ 2 2)' | nc 127.0.0.1 4141
;; used to demonstrate evaluation
; -*-lisp-*-
;; Load swank.
;; *prefix-key* ; swank will kick this off
(ql:quickload :swank)
(let ((server-running nil))
(defcommand swank () ()
"Toggle the swank server on/off"
(if server-running
(progn

Reader Macros in Common Lisp

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

Macros and read-macros see your program at different stages. Macros get hold of the program when it has already been parsed into Lisp objects by the reader, and read-macros operate on a program while it is still text. However, by invoking read on this text, a read-macro can, if it chooses, get parsed Lisp objects as well. Thus read-macros are at least as powerful as ordinary macros.

@kisom
kisom / files.txt
Created April 10, 2014 04:39
golang v. find|xargs
This file has been truncated, but you can view the full file.
total 1920004
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346539308486
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346540035848
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346540246418
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346540567344
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346540853738
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346541058648
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346541260301
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346541543718
-rw-r--r-- 1 kyle kyle 65536 Apr 9 22:32 dump-1397104346541762984
// This program is a simple web server that listens for IP address
// updates. There's no authentication or security at all; I use it
// to keep track of beaglebones on a LAN.
package main
import (
"fmt"
"log"
"net/http"
"os"
@kisom
kisom / gtcov
Created October 19, 2014 01:24
gtcov
#!/bin/sh
# Produce an HTML file displaying code coverage. Dependencies:
# - cloc (apt-get install cloc)
# - cover (go get code.google.com/p/go.tools/cmd/cover)
if [ -z "$1" ]; then
PKG=""
else
PKG=$1
fi
@kisom
kisom / dump-container
Created November 14, 2014 17:34
Export a container to a GPG-encrypted tarball.
#!/bin/sh
CONTAINER="$1"
BASENAME="$2"
OWNER="[email protected]"
if [ -z "$BASENAME" ]
then
echo "No basename provided."
exit