Skip to content

Instantly share code, notes, and snippets.

@mhl
mhl / get-tinyurl.rb
Created September 20, 2009 18:06
Create a tinyurl from Ruby
#!/usr/bin/ruby
require 'cgi'
unless ARGV.length == 1
STDERR.puts "Usage: tinyurl <URL>"
exit(1)
end
url = ARGV[0]
@mhl
mhl / copy-over-podcasts.py
Created November 17, 2009 14:29
Most recent podcasts playlist
#!/usr/bin/python2.5
import sys
import os
import stat
import re
from subprocess import call, check_call, Popen, PIPE
from optparse import OptionParser
# I've found this script useful for copying my most recently
@mhl
mhl / helvetireader.css
Created December 11, 2009 18:00
A variation of Helvetireader
/*Version 1.51 15.06.09*/
/* @group Helvetireader */
* {font-family: "Helvetica Neue", Helvetica, "MgOpen Moderna", sans-serif !important;}
body {background-color: #fff !important;}
/* Anything to to hide? */
@mhl
mhl / fix-ogg-length.sh
Created December 11, 2009 18:20
Fix Ogg Vorbis files with vcut
#!/bin/sh
# If you have a lot of Ogg Vorbis files with lengths that are wildly
# wrong or have incomplete data at the start, you may be able to fix
# them with this script. I invoked this for a whole directory of
# files with:
# find . -iname '*.ogg' -print0 | xargs -0 -n 1 fix-ogg-length.sh
set -e
echo Fixing "$1"
@mhl
mhl / stupid-emusic.sh
Created January 13, 2010 10:13
Tiny eMusic Download Script
#!/bin/sh
if [ $# -ne 1 ]
then
echo Usage: $0 "<path-to-download.emx>"
exit 1
fi
for i in $(xml_grep 'TRACKURL' $1|sed 's/.*\(http.*mp3\).*/\1/'|egrep http)
do
@mhl
mhl / pdf-pages-with-graphics.py
Created January 13, 2010 10:36
Split a PDF into pages with graphics and those without
#!/usr/bin/python2.5
# This script attempts to take a PDF file and split it into two PDF
# files, one of which has all the images and the other which has
# everything else. You can select pages by whether they contain
# /Subtype /Image (bitmaps in my case) or /XObject which seems to
# catch bitmaps and included PDF files (which are most diagrams
# exported to PDF in my case).
import os
@mhl
mhl / gist:293827
Created February 3, 2010 17:56
Usernames from my git svn import of ukparse
$ git log --format="%an"|sort|uniq
fjmd1
frabcus
goatchurch
heathd
louise
mark
sams
solidgoldpig
sym
@mhl
mhl / merge-pwsafe-from.py
Created June 11, 2010 07:54
Grab ~/.pwsafe.dat over ssh and merge it with your local version
#!/usr/bin/python3.1
import sys
import re
import tempfile
from subprocess import call, check_call
import os
def print_usage():
print("Usage: {} user@host".format(sys.argv[0]))
--- Polar_Transformer.original.java 2008-03-10 21:52:08.000000000 +0100
+++ Polar_Transformer.java 2010-06-25 15:27:13.171811587 +0200
@@ -73,37 +73,56 @@
if (showDialog(ipInitial))
{
-
- widthInitial = ipInitial.getWidth();
- heightInitial = ipInitial.getHeight();
- if (ipInitial instanceof ColorProcessor) isColor = true;
@mhl
mhl / enweb.py
Created July 27, 2010 11:59
A script for uploading a local file to be web visible, outputting a URL
#!/usr/bin/python3.1
import sys
import os
import urllib.parse
from subprocess import call
if len(sys.argv) != 2:
print("Usage: {} [FILE-OR-DIRECTORY]".format(sys.argv[0]),file=sys.stderr)
sys.exit(1)