Skip to content

Instantly share code, notes, and snippets.

@aturley
aturley / README.md
Created July 19, 2012 13:58
irssi to pubnub to web page for remote IRC message notification. Remember to set the keys in the scripts. The soundcloud player API wrapper is from https://github.com/soundcloud/Widget-JS-API/blob/master/soundcloud.player.api.js .

To use this, just:

  • Modify the source to use your keys.
  • Put pnnotify.pl in your .irrsi/script directory and run "/script load pnnotify.pl" in irssi.
  • Put the .html and .js files in a directory and server the up in a web server.
  • Open up http://yourserverhere/notify.html in a browser.

Now, whenever you get a message in IRC, you'll know.

@aturley
aturley / sig.bf
Created August 1, 2012 00:04
This was my email sig for a while. It's a Befunge program that generates a Serpinski triangle.
>84*>:#v_55+"ude.ub@yelruta">:#,_@>188*+>\02p\12p\:22p#v_$ 55+,1- v
^ 0 v +1\ _^#-+*< >22g02g*"_@"*-!1- #v_v>
>:>::3g: ,\188 ^^ -1\g21\g22<p3\"_":<
________________________________@_________________________________^ p3\"@":<
@aturley
aturley / links.md
Created August 9, 2012 22:22
4 part series about writing a url shortening service in erlang (using webmachine)
@aturley
aturley / ringmodulation.js
Created November 11, 2012 21:28
Ring modulation using the web audio api
var wac = new webkitAudioContext();
var ringGain = wac.createGainNode();
ringGain.gain.setValueAtTime(0, 0);
var ringCarrier = wac.createOscillator();
ringCarrier.type = ringCarrier.SINE;
ringCarrier.frequency.setValueAtTime(2500, 0);
var url = "Ring_Modulation-Original_sample.ogg";
@aturley
aturley / ab
Created January 22, 2013 18:10
We have some systems at work that use the database as a queue. I've been thinking about this a bit. So have other people.
* [5 subtle ways you’re using MySQL as a queue, and why it’ll bite you](https://blog.engineyard.com/2011/5-subtle-ways-youre-using-mysql-as-a-queue-and-why-itll-bite-you)
* [A Look At Using Your Database As a Queue](http://it.toolbox.com/blogs/programming-life/a-look-at-using-your-database-as-a-queue-49143)
* [What’s the Best Way to Manage a Database Queue?](http://johnnycoder.com/blog/2007/06/20/whats-the-best-way-to-manage-a-database-queue/)
* [Looking for example design of using an SQL database as a queue for throttling web service requests of multiple users](http://dba.stackexchange.com/questions/17385/looking-for-example-design-of-using-an-sql-database-as-a-queue-for-throttling-we)
* [Using Tables as Queues](http://rusanu.com/2010/03/26/using-tables-as-queues/)
(ns phpon.core
(:require [instaparse.core :as insta]))
(def parse-awful
(insta/parser
"
<S> = (ARRAY / INTEGER / STRING)
ARRAY = <'a:'> SIZE <':'> REST
INTEGER = <'i:'> INT <';'>
STRING = <'s:'> SIZE <':\"'> REST
@aturley
aturley / gist:8302694
Last active April 1, 2016 20:39
BLOGPOST Just Say "No" to "Just

Recently I've been trying to modify the way that I use the word "just" when I'm at work. Merriam Webster offers a few definitions of the word; the one I'm interested in is the one that means "only", "simply", and to a lesser extent "exactly". I've been working on a new project that involves integrating a number of systems, and as I began rolling pieces out I received a lot a questions in the form of "Couldn't you just ...?" These annoyed me at first, but as I thought about it I realized I often asked questions in the same way, so I began to examine the word and the way I use it.

let lit = [(lambda(s:String): String ref => String().append(s) end, lambda(s:String): String ref => String().append(s) end),
(lambda(s:String): String ref => String().append(s).append(s) end, lambda(s:String): String ref => String().append(s).append(s) end),
(lambda(s:String): String ref => String().append(s).append(s).append(s) end, lambda(s:String): String ref => String().append(s).append(s).append(s) end)]
var result = String()
for (la, lb) in lit.values() do
result = result.append(la("a")).append(lb("b"))
end
@aturley
aturley / sqlite-in-5-minutes.pony
Last active June 26, 2020 10:58
This is a Pony reimplementation of the C example from the SQLite quickstart page (http://sqlite.org/quickstart.html), using Pony's FFI system (http://tutorial.ponylang.org/c-ffi/calling-c/). In writing it I found a bug in Pony (which was subsequently fixed), so the exercise was good for something other than just learning. I'm still learning Pony…
use "collections"
use "lib:sqlite3"
actor Main
let _env: Env
new create(env: Env) =>
_env = env
let args = env.args
var db: Pointer[U8] = Pointer[U8]