Skip to content

Instantly share code, notes, and snippets.

View kisom's full-sized avatar

Kyle Isom kisom

View GitHub Profile
@kisom
kisom / build-image.lisp
Created January 1, 2012 20:33
automatically generate a quicklisp-enhanced sbcl image
#!/usr/bin/env sbcl --script
;;;; build-image.lisp
;;;; build a customised sbcl image
;;;;
;;;; you can modify the package list by changing the *base-packages*
;;;; global variable. this is useful for building a custom binary with
;;;; your commonly used libraries already present (at the expense of
;;;; some memory) but will cut down on load times.
; -*-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
#!/bin/sh
# script to change the sleep mode of an OS X machine
usage () {
echo "supported sleep modes:"
echo " sleep"
echo " safesleep"
echo " hibernate"
echo " secure"
echo " insecure"
@kisom
kisom / mydaemon
Created April 28, 2013 06:10
Sample Upstart and sysvinit script for Go daemons.
#! /bin/sh
### BEGIN INIT INFO
# Provides: mydaemon
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mydaemon does stuff
# Description: this is an actual executable script, and should be saved in
# /etc/init.d/mydaemon.
@kisom
kisom / configfile.c
Created September 18, 2011 17:19
C function to split a buffer into a char ** containing each line.
/*
* written by kyle isom <coder@kyleisom.net>
* license: isc / public domain dual license
* one of the functions i wrote for the lurker project
* (https://github.com/kisom/lurker) project
*
* from twitter (@kyleisom):
* '"so a char * goes to a char ** where each char * in the char ** is a line
* in the first char *" - me explaining my C algorithm to @qb1t'
*/
@kisom
kisom / gist:3140167
Created July 19, 2012 01:28
Undefined symbol errors in Lisp

The other day, I got a strange error while writing a macro (actually, deftest from Peter Seibel's Practical Common Lisp. My defmacro looked like this:

(defmacro deftest (name parameters &body body)
  `(defun ,name ,parameters
     (let ((*test-name* ,name))
       ,@body)))

At first glance, it looks fine. So, I defined a few tests with it (check is another macro for reporting test results):

@kisom
kisom / example.txt
Created July 31, 2012 18:57
Python command line utility to determine whether a site supports HSTS.
<monalisa: ~> $ has_hsts.py duckduckgo.com google.com search.google.com conformal.com yahoo.com lobste.rs news.ycombinator.com reddit.com
[+] checking whether duckduckgo.com supports HSTS... no
[+] checking whether google.com supports HSTS... no
[+] checking whether search.google.com supports HSTS... no
[+] checking whether conformal.com supports HSTS... yes
[+] checking whether yahoo.com supports HSTS... no
[+] checking whether lobste.rs supports HSTS... yes
[+] checking whether news.ycombinator.com supports HSTS... no
[+] checking whether reddit.com supports HSTS... doesn't have SSL working properly (hostname 'reddit.com' doesn't match either of 'a248.e.akamai.net', '*.akamaihd.net', '*.akamaihd-staging.net')
@kisom
kisom / db.cc
Created January 30, 2020 15:33
sqlitec++ example
bool
Tag(SQLite::Database &db, kortex::store::Tag tag)
{
if (!Metadata(db, tag.Meta)) {
return false;
}
SQLite::Statement q(db, "INSERT INTO tags (id, name, metadata) VALUES (?, ?, ?)");
q.bind(1, tag.ID());
q.bind(2, tag.Name());
@kisom
kisom / keybase.md
Created August 9, 2018 22:24
keybase.md

Keybase proof

I hereby claim:

  • I am kisom on github.
  • I am kisom (https://keybase.io/kisom) on keybase.
  • I have a public key ASB4v1uzRtIwO-v83dUbp0YXedoSrzLRB7yGb-oYZy5ZGAo

To claim this, I am signing this object:

@kisom
kisom / Makefile.am
Created November 20, 2012 21:13
C / automake test stubs for unit testing
SUBDIRS = tests
TESTS = tests/stub_test