Skip to content

Instantly share code, notes, and snippets.

@hanshuebner
hanshuebner / rc.local
Created March 28, 2014 09:19
my tmux start stuff
#!/bin/sh
su hans -c '/home/hans/bin/start-tmux.sh'
@hanshuebner
hanshuebner / gist:11211196
Created April 23, 2014 11:14
Create high-level varnish events in librato
var readline = require('readline');
var spawn = require('child_process').spawn;
var request = require('request');
var config = {
interval: 10000,
email: 'email-address@example.com',
apitoken: 'the-librato-readonly-api-token'
};
@hanshuebner
hanshuebner / gist:4573c0bd258c507aeaee
Created September 18, 2014 15:58
l1-sockets.lisp with initial ipv6 support
;;;-*- Mode: Lisp; Package: CCL -*-
;;;
;;; Copyright (C) 2001-2009 Clozure Associates
;;; This file is part of Clozure CL.
;;;
;;; Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
;;; License , known as the LLGPL and distributed with Clozure CL as the
;;; file "LICENSE". The LLGPL consists of a preamble and the LGPL,
;;; which is distributed with Clozure CL as the file "LGPL". Where these
;;; conflict, the preamble takes precedence.
@hanshuebner
hanshuebner / centos7_timechine.sh
Last active August 29, 2015 14:28 — forked from darcyliu/centos7_timechine.sh
Install Time Machine service on CentOS 7
# Install Time Machine service on CentOS 7
# http://netatalk.sourceforge.net/wiki/index.php/Netatalk_3.1.7_SRPM_for_Fedora_and_CentOS
# http://confoundedtech.blogspot.com/2011/07/draft-draft-ubuntu-as-apple-time.html
yum install -y rpm-build gcc make wget
# install netatalk
yum install -y avahi-devel cracklib-devel dbus-devel dbus-glib-devel libacl-devel libattr-devel libdb-devel libevent-devel libgcrypt-devel krb5-devel mysql-devel openldap-devel openssl-devel pam-devel quota-devel systemtap-sdt-devel tcp_wrappers-devel libtdb-devel tracker-devel
yum install -y bison docbook-style-xsl flex dconf
@hanshuebner
hanshuebner / plist-parser.js
Created June 1, 2011 05:44
plist parser written in node.js
var plistParser = require("../lib/sax").parser(false, {lowercasetags:true, trim:true}),
sys = require("sys"),
fs = require("fs");
function entity (str) {
return str.replace('"', '"');
}
plistParser.getInteger = function (string) {
this.value = parseInt(string, 10);
@hanshuebner
hanshuebner / qdiff.lisp
Created September 27, 2011 13:04
Diff checked-out quicklisp project against dist version
;;;; qdiff.lisp
(defpackage #:qdiff
(:use #:cl)
(:shadowing-import-from #:ql-dist
#:name
#:release
#:ensure-local-archive-file
#:base-directory
#:prefix)
@hanshuebner
hanshuebner / fixed-width-record.lisp
Created April 15, 2012 19:20
fixed width record reading and writing
(defpackage :fixed-width-record
(:use :cl)
(:export #:define-format
#:write*
#:read*
#:field-parse-error
#:create-table
#:insert-record))
(in-package :fixed-width-record)
@hanshuebner
hanshuebner / gist:f15e915e349f0ca0f979
Created November 19, 2015 20:44
ClojureScript errro
clabin 1175_% rlwrap lein run -m clojure.main script/figwheel.clj
Figwheel: Starting server at http://localhost:3449
Figwheel: Watching build - dev
Compiling "resources/public/js/main.js" from ["src"]...
Reading analysis cache for jar:file:/Users/hans/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/cljs/core.cljs
Compiling target/figwheel_temp/dev/figwheel/connect.cljs
Reading analysis cache for jar:file:/Users/hans/.m2/repository/org/omcljs/om/1.0.0-alpha22/om-1.0.0-alpha22.jar!/om/util.cljs
Reading analysis cache for jar:file:/Users/hans/.m2/repository/org/omcljs/om/1.0.0-alpha22/om-1.0.0-alpha22.jar!/om/dom.cljs
{:tag :cljs/analysis-error}
ANALYSIS ERROR: Map literal must contain an even number of forms on file null, line null, column null
@hanshuebner
hanshuebner / voting.lua
Last active April 10, 2017 05:07
NodeMCU program to read buttons and light up LEDs, communicates with MQTT
broker_ip_address='192.168.178.19'
wifi.sta.config({ssid="ssid",pwd="password"})
m = mqtt.Client('esp', 120, 'dev', 'dev')
wifi.setmode(wifi.STATION)
gpio.mode(1, gpio.INPUT, gpio.PULLUP)
gpio.mode(2, gpio.INPUT, gpio.PULLUP)
gpio.mode(3, gpio.OUTPUT, gpio.PULLUP)
@hanshuebner
hanshuebner / live-clip-recorder.js
Created May 28, 2011 20:00
Ableton Live MIDI controlled clip recording
// While jamming with a keyboard, I often want to record some theme into a clip.
// I find it rather disruptive to have reach out for the mouse, or find a free clip
// slot on an APC, or use a touch interface or whatever. So this script comes to the
// rescue. It listens to MIDI events that I can trigger with a foot switch and records
// clips to the currently selected track. It uses the global quantization setting to
// determine the length of the clips that are created. Three MIDI events are used,
// one to record one clip, one to record clips until stops, and one to stop recording.
// The script automatically adds clips to the end of the currently selected track.