Skip to content

Instantly share code, notes, and snippets.

@ztmr
ztmr / lfe_on_load.txt
Created October 27, 2014 12:20
LFE on_load attribute
The following works well:
(defmodule dws_lisp_service
(export (version 1)
(do-eval 4))
(on_load #(autoregister 0)))
...unlike the following:
(defmodule dws_lisp_service
@ztmr
ztmr / keybase.md
Created September 30, 2014 19:30
keybase.md

Keybase proof

I hereby claim:

  • I am ztmr on github.
  • I am ztmr (https://keybase.io/ztmr) on keybase.
  • I have a public key whose fingerprint is 5F6D 544F 75D7 B56A C254 F04A DBC2 9532 E23F 6630

To claim this, I am signing this object:

@ztmr
ztmr / spotify-adkiller.pl
Last active August 29, 2015 14:03
Spotify AdKiller written in Perl. It will simply mute Spotify's PulseAudio sink once the current track is about to end (= running over its official length) and unmute once a new track has started playing. What a naive solution to cut the advertisement injected at the end of the track!
#!/usr/bin/env perl
#
# $Id: $
#
# Module: spotify-adkiller -- Naive Spotify AdKiller
# Created: 03-JUL-2014 19:54
# Author: tmr
#
# TODO:
@ztmr
ztmr / unix_login_records.erl
Created March 13, 2014 20:51
UNIX Login Records (utmp/wtmp) Parser in Erlang
%% UNIX Login Records (utmp/wtmp) Parser
%% Only GNU/Linux on x86_64 is supported at the moment.
-module (unix_login_records).
-export ([
read_utmp/0, read_wtmp/0,
parse_file/1, parse/1,
record_to_proplist/1
]).
-type utmp_type_code () :: integer ().
@ztmr
ztmr / ztmr.fs
Created March 12, 2014 20:24
F# command line arguments parsing, factorial, lambdas, and pipe operator fun
// Build:
// $ fsharpc ztmr.fs
// Use:
// $ mono ztmr.exe 5
open System
let rec factorial n =
match n with
| 0 -> 1
@ztmr
ztmr / gist:9009442
Created February 14, 2014 21:16
LuvvieScript build issues
tmr@gersemi:~/src/erl/misc$ git clone https://github.com/hypernumbers/LuvvieScript Cloning into 'LuvvieScript'...
remote: Reusing existing pack: 784, done.
remote: Total 784 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (784/784), 1.01 MiB | 546 KiB/s, done.
Resolving deltas: 100% (405/405), done.
tmr@gersemi:~/src/erl/misc$ cd LuvvieScript/
tmr@gersemi:~/src/erl/misc/LuvvieScript$ rebar get-deps
==> LuvvieScript (get-deps)
Pulling mochiweb from {git,"git://github.com/mochi/mochiweb.git","master"}
Cloning into 'mochiweb'...
@ztmr
ztmr / inf.c
Created January 19, 2014 20:19
Inf and NaN values handling in C.
/*
* $Id: $
*
* Module: inf -- description
* Created: 18-DEC-2007 19:17
* Author: tmr
*/
#define INF (1.0 / 0.0)
#define NAN (0.0 / 0.0)
@ztmr
ztmr / addInt.c
Created January 19, 2014 20:17
Add a new record to the OpenVMS intrusion database. Uses a $SCAN_INTRUSION system service. http://h71000.www7.hp.com/doc/82final/4527/4527pro_097.html#jul93_317
/*
* addInt.c, v0.1 -- Manually add an intrusion database record
*/
#include <stdio.h>
#include <stdlib.h>
#include <descrip.h>
#include <ssdef.h>
#include <jpidef.h>
#include <ciadef.h>
@ztmr
ztmr / free.c
Created January 19, 2014 20:11
OpenBSD equivalent of `free' Linux command. Shows memory usage.
/*
* $Id: $
*
* Module: free -- description
* Created: 15-SEP-2008 17:56
* Author: tmr
*/
#include <stdio.h>
#include <unistd.h>
@implementation CalendarView: CPView
{
}
-(id)init {
self = [super initWithFrame:CGRectMake(0, 0, 200, 200)];
if (self) {
[self loadData];
}
return self;