Skip to content

Instantly share code, notes, and snippets.

@quad
quad / merryspam.py
Created Dec 25, 2008
Spam your friends with Christmas Greetings
View merryspam.py
#!/usr/bin/env python
#
# Spam your phonebook (Nokia) with Christmas cheer.
#
# Usage: merryspam.py vcards names
#
# How do I get the "vcards"?
#
# gnokii --getphonebook ME 1 end -v > ME.vcards
# gnokii --getphonebook SM 1 end -v > SM.vcards
@quad
quad / forward-test.py
Created Apr 19, 2009
A hilarious use of the Skype API to connect random people together.
View forward-test.py
#!/usr/bin/env python
import logging
import dbus
import dbus.service
import gobject
# Set DBUS as the default MainLoop.
from dbus.mainloop.glib import DBusGMainLoop
@quad
quad / any-month.py
Created May 10, 2009
What did you listen to the most on any given month? (via last.fm)
View any-month.py
#!/usr/bin/env python
#
# any-month.py
#
# What did you listen to the most on any given month? (via last.fm)
#
# Example:
#
# $ find ~/public_html/mixtape -name index.xspf -print0 | xargs -0 ./any-month.py
# Wild Orchid Children where the mexican boys go
@quad
quad / multi-browser.vala
Created May 26, 2009
Minimal WebKit browser examples in Vala
View multi-browser.vala
using GLib;
using Gtk;
using WebKit;
public class Browser : Window {
private const string URL = "http://mixtape.quadhome.com/6/";
private Notebook notebook;
public Browser() {
@quad
quad / get-jwz-djabberd.sh
Created Oct 8, 2009
jwz wants to try DJabberd
View get-jwz-djabberd.sh
#!/bin/sh -e
#
# jwz wants to try DJabberd.
#
# Hope you're using Debian.
sudo aptitude install \
perl \
libdanga-socket-perl \
libdigest-hmac-perl \
@quad
quad / DllTest.d
Created Nov 8, 2009
Generate the missing symbols for loading mod_dav_svn
View DllTest.d
import tango.sys.SharedLib;
import tango.text.convert.Format;
import tango.util.log.Trace;
bool load(char[] name) {
if (auto lib = SharedLib.load(name)) {
Trace.formatln(Format("{} loaded.", name));
return true;
}
@quad
quad / bootstrap.sh
Created Feb 11, 2010
Deploy stardate on julia
View bootstrap.sh
#!/bin/sh -e
deploy ()
{
VERSION="2.5"
PYTHON="$(which python$VERSION)"
export PYTHONPATH="$1/lib/python$VERSION/site-packages"
mkdir -p $PYTHONPATH
@quad
quad / zim-to-sn.rb
Created Nov 1, 2010
Import a (my) Zim notebook to Simplenote
View zim-to-sn.rb
#!/usr/bin/env ruby
require 'json'
require 'Simplenote'
class ZimDirectory < Hash
class ZimException < Exception
end
attr_reader :dir
@quad
quad / psplit.py
Created Dec 2, 2010
At YOW!2010, Guy Steele gave a great talk entitled "How to Think about Parallel Programming---Not!"
View psplit.py
#
# At YOW!2010, Guy Steele gave a great talk entitled "How to Think about
# Parallel Programming---Not!"
#
# In it, he presented an implementation of a divide and conquer strategy for
# splitting a string.
#
# His solution was written in Fortress.
#
# People nearby me were confused.
@quad
quad / card-game.py
Created Dec 29, 2010
My friend, Dan Coffman, posed a game on his Facebook...
View card-game.py
#
# My friend, Dan Coffman, posed a game on his Facebook. Some people answered. I
# didn't believe that one of them was wrong.
#
# A game (reworded to remove misleading 'i.e.'):
#
# The dealer shuffles a deck of cards and reveals them face up one at a time.
# At any time, you can interrupt the dealer and bet that the next card will be
# red. If the card is red, you win. If it is black, you lose. Is there a
# strategy that will allow you to win more than half your games?