Skip to content

Instantly share code, notes, and snippets.

View clee's full-sized avatar

Chris Lee clee

View GitHub Profile
@clee
clee / ichat-unarchiver.rb
Created April 15, 2011 09:31
read from iChat conversation logs using MacRuby
#!/usr/bin/env macruby
framework 'Foundation'
framework 'AppKit'
class Person
def initWithCoder(decoder)
# empty implementation needed for ancient iChat conversations
end
end
@clee
clee / binary-plist.js
Created June 3, 2011 21:36
initial binary plist implementation in nodejs
#!/usr/bin/env node
var fs = require('fs');
var sys = require('sys');
var bin = require('binary');
function bytesize(n) {
// JavaScript can't handle 64-bit ints natively.
// TODO: hack it up anyway.
// (n & 0xFFFFFFFF00000000) ? 8 : ...
@clee
clee / cpacl.c
Created June 11, 2011 22:24
copy ACL from source to target
/*
cpacl.c: copy solaris ACLs from one file to another
author: Chris Lee <clee@mg8.org>
license: WTFPL <http://sam.zoy.org/wtfpl/COPYING>
make: cc -o cpacl cpacl.c -lsec -lc
*/
#include <sys/acl.h>
#include <stdio.h>
@clee
clee / app-client.js
Last active September 30, 2015 23:58
EventSource demo code
$.ready(function() {
var source = new EventSource("/events");
source.addEventListener('data', function(e) {
$("#content").append(e.data + "\n");
}, false);
});
@clee
clee / free.d
Created August 21, 2012 05:15
script to trace invocations of 'free'
#!/usr/sbin/dtrace
pid$target::free:entry
{
printf("%s: %s\n", probefunc, copyinstr(arg0));
}
@clee
clee / agealyzer.clj
Last active April 14, 2018 08:41
agealyzer: given a root directory, spits out histogram of ages of files
(ns clee.agealyzer)
(require '[clojure.java.io :as io])
(defn date [x] (java.util.Date. x))
(defn is-file? [f] (.isFile f))
(defn last-modified [f] (.lastModified f))
(defn get-year [x] (.getYear x))
(defn process-dir
@clee
clee / tailpipe.go
Created August 20, 2013 22:10
tailpipe uses 'tail -f' to read a file, and spits out the result over EventSource to whoever's listening.
package main
import (
eventsource "github.com/msgehard/goEventSource"
"encoding/json"
"net/http"
"os/exec"
"flag"
"log"
// "fmt"
@clee
clee / form.html
Created October 21, 2013 21:21
DreamObjects snippets for DreamScape article
<form action="https://promethean.objects.dreamhost.com/" method="POST" enctype="multipart/form-data">
<input type="hidden" name="key" value="uploads/${filename}">
<input type="hidden" name="AWSAccessKeyId" value="nr-q3_Rsprv94CdsuEpI">
<input type="hidden" name="acl" value="private">
<input type="hidden" name="success_action_redirect" value="http://c133.org/tmp/dho-success.html">
<input type="hidden" name="policy" value="eyJleHBpcmF0aW9uIjogIjIwMTUtMDEtMDFUMDA6MDA6MDBaIiwKICAiY29uZGl0aW9ucyI6IFsKICAgIHsiYnVja2V0IjogImNsZWUifSwKICAgIFsic3RhcnRzLXdpdGgiLCAiJGtleSIsICJ1cGxvYWRzLyJdLAogICAgeyJhY2wiOiAicHJpdmF0ZSJ9LAogICAgeyJzdWNjZXNzX2FjdGlvbl9yZWRpcmVjdCI6ICJodHRwOi8vYzEzMy5vcmcvdG1wL2Roby1zdWNjZXNzLmh0bWwifSwKICAgIFsic3RhcnRzLXdpdGgiLCAiJENvbnRlbnQtVHlwZSIsICIiXQogIF0KfQo=">
<input type="hidden" name="signature" value="zYcruOMR6qr7o6/Syj001g/trms=">
<input type="hidden" name="Content-Type" value="image/jpeg">
File to upload to DreamObjects: <input name="file" type="file">
<input type="submit"
@clee
clee / ssl.conf
Created April 10, 2014 19:09
nginx SSL configuration
ssl_session_cache shared:SSL:32m;
ssl_session_timeout 10m;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-RC4-SHA:HIGH:!MD5:!aNULL:!EDH;
ssl_prefer_server_ciphers on;
@clee
clee / keybase.md
Created April 13, 2014 20:38
Keybase proof

Keybase proof

I hereby claim:

  • I am clee on github.
  • I am clee (https://keybase.io/clee) on keybase.
  • I have a public key whose fingerprint is 32EF 25A2 BA27 0268 2C0F 0662 7A6B DC1F F1DD 2862

To claim this, I am signing this object: