Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import threading
import Queue
class Runner(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue
def run(self):
@DamianZaremba
DamianZaremba / gist:1050651
Created June 28, 2011 07:06
Make cv stuff from Pod file.
#!/bin/bash
pod2pdf --noheader damianzaremba.man > damianzaremba.pdf
pod2man damianzaremba.man | \
sed 's/\.\\" Automatically generated by .*//' | \
sed "s/\.TH DAMIANZAREMBA.MAN 1 \".*\" \".*\" \".*\"/.TH DAMIANZAREMBA 1 \"$(date +%Y)\" \"Damian Zaremba\" \"Damian Zaremba\"/" | \
gzip > man/man1/damianzaremba.1.gz
man -M "$( pwd )/man/" damianzaremba
@DamianZaremba
DamianZaremba / formatted_date_example.sh
Created July 10, 2011 21:52
Unix time to human readable examples
root@localhost [/]# date -d@1290705757 +"%H:%M:%S %d/%m/%Y"
18:22:37 25/11/2010
@DamianZaremba
DamianZaremba / gist:1086806
Created July 16, 2011 21:25
Demo of using __dict__ to pull stuff out of objects.
DamiansMacBookPro:patchwork damian$ python
clPython 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class Boob(object):
... someawesomething = "nipple"
...
>>> abc = Boob()
>>> print(abc.someawesomething)
nipple
@DamianZaremba
DamianZaremba / gist:1088141
Created July 17, 2011 22:09
Crappy module
<?php
/*
Plugin Name: LastFM
Plugin URI:
Description: Displays data from LastFM
Author: damianzaremba
Author URI: http://damianzaremba.co.uk
Version: 1.0
License: GPL3
*/
@DamianZaremba
DamianZaremba / grab_emails.pl
Created July 18, 2011 23:25
Perl script for grabbing emails from an IMAP folder
#!/usr/bin/perl
use strict;
use Mail::IMAPClient;
use IO::Socket;
use IO::Socket::SSL;
use Time::ParseDate;
use Data::Dumper;
# Config stuff
my $mail_hostname = '';
@DamianZaremba
DamianZaremba / update_github_hooks.py
Created July 23, 2011 20:49
Ugly hack to quicky set github hooks... lets hope they make an api soon.
#!/usr/bin/python
import urllib2
import urllib
import cookielib
from BeautifulSoup import BeautifulSoup
try:
from simplejson import json
except ImportError:
import json
@DamianZaremba
DamianZaremba / gist:1103944
Created July 25, 2011 11:23
Github API bizzaeness - well not really v3 sends a http header with hyperlinks to the next page, WTF!
prel -e 'use JSON;
use LWP::Simple;
my $data = get "https://api.github.com/users/damianzaremba/repos";
my $json = decode_json($data);
print "Found: ";
my $count=0;
for(@$json) { print $_->{"name"} . ","; $count++; };
print " (" . $count . ") repos\n";'
Found: ClueNet, Bordness, damianzaremba.github.com, api-scripts, Me,
#!/usr/bin/env perl
use strict;
use Net::Twitter::Lite;
use Date::Format;
my $client = Net::Twitter::Lite->new(
consumer_key => "",
consumer_secret => "",
);
@DamianZaremba
DamianZaremba / auto_rejoin.pl
Created July 31, 2011 11:02
Modified irssi auto_rejoin script
# automatically rejoin to channel after kick
# delayed rejoin: Lam 28.10.2001 ([email protected])
# NOTE: I personally don't like this feature, in most channels I'm in it
# will just result as ban. You've probably misunderstood the idea of /KICK
# if you kick/get kicked all the time "just for fun" ...
use Irssi;
use Irssi::Irc;
use strict;