Skip to content

Instantly share code, notes, and snippets.

@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/)
@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 / links.md
Created August 9, 2012 22:22
4 part series about writing a url shortening service in erlang (using webmachine)
@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 / 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 / minpylint.py
Created June 27, 2012 18:49
Minimum python file that gets a 10/10 from pylint
"x"
@aturley
aturley / ga_invite.rb
Created June 20, 2012 17:41
GA code snipped
if know_code = true
print "forward this email to 5 friends."
else
print "teach me how to code!"
end
@aturley
aturley / git-codecheck
Created June 20, 2012 14:55
Run pep8 and pylint on all of the new and modified Python files in a git repo.
#!/bin/bash
if [ -z "$(which pep8)" ];
then
echo "Could not find pep8"
exit 1
fi
if [ -z "$(which pylint)" ];
then
@aturley
aturley / gist:2955828
Created June 19, 2012 18:45
regex vs split and test in Python
aturley@silverslab [~/play]$ cat regex_vs_split.py
import time
import re
url = "http://octopart.com/api/v2/parts/match?manufacturer_name=texas+instruments&mpn=SN74LS240N&suppress_status_codes=True"
url_x = "http://octopart.com/api/v2/parts/match?manufacturer_name=texas+instruments&mpn=SN74LS240N"
url_l = "http://octopart.com/api/v2/parts/match?manufacturer_name=texas+instruments&mpn=SN74LS240N&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&