Skip to content

Instantly share code, notes, and snippets.

View gelendir's full-sized avatar

Gregory Eric Sanderson gelendir

View GitHub Profile
@gelendir
gelendir / sh_examples.py
Created February 4, 2014 21:21
Python sh examples
from sh import ifconfig, git, cd, touch, wc, find, ps, tail, ls, mkdir
def iface_info(iface='wlan0'):
print(ifconfig(iface))
def create_git_repo(path):
mkdir(path, p=True)
cd(path)
@gelendir
gelendir / tdd_notes.md
Last active August 29, 2015 14:00
tdd

commands

beginner

  • cat
  • echo
  • date
  • sleep
@gelendir
gelendir / notetime.py
Created April 10, 2015 19:33
Show time under musical notation form
from __future__ import unicode_literals
from datetime import datetime
WHOLE_NOTE = "\U0001D15D"
HALF_NOTE = "\U0001D15E"
QUARTER_NOTE = "\U0001D15F"
EIGHTH_NOTE = "\U0001D160"
WHOLE_REST = "\U0001D13B"
HALF_REST = "\U0001D13C"
@gelendir
gelendir / java2python.py
Created November 26, 2010 02:56
java2python
#!/usr/bin/python
import sys
from optparse import OptionParser
usage = """%prog : convert java app to an equivalent in python code.
usage : %prog PROGRAM"""
parser = OptionParser(usage=usage)
(options, args) = parser.parse_args()
@gelendir
gelendir / expire_notify.py
Created December 10, 2010 02:09
send emails to users when their account expires soon. Made for LinuQ
#!/usr/bin/python2
# coding=utf-8
import csv
import datetime
import codecs
import smtplib
import traceback
import os.path
from email.mime.text import MIMEText
@gelendir
gelendir / xdcc_search.py
Created December 16, 2010 17:43
Query XDCC Parser server for packs
#!/usr/bin/python2
"""
XDCC package list retriever
Ugly quick hack by Gregory Eric Sanderson Turcot Temlett MacDonnell Forbes
Sends a search request to a XDCC Parser server (http://xdccparser.is-fabulo.us) and returns a list of packs.
Requires python2.6 and python-spidermonkey (http://github.com/davisp/python-spidermonkey)
"""
import sys, urllib, spidermonkey, json
@gelendir
gelendir / beer.lol
Created May 22, 2011 00:49
simple implementation of 99 bottles of beer song in LOLCODE
HAI 1.2
HOW DUZ I HOLLAR YR LOLZ
VISIBLE LOLZ
IF U SAY SO
HOW DUZ I SING YR BEER
HOLLAR SMOOSH "I CAN HAZ " AN BEER AN " BOTLEZ O BEER ON TEH WAL !1!!ONE!!"
IF U SAY SO
HOW DUZ I SING_MOAR YR BEER
BEER R DIFF OF BEER AN 1
HOLLAR SMOOSH "TAEK ONE DAOWN AN PASS ITZ ARAOUND " AN BEER AN " BOTLEZ ON TEH WAL !!1!!!1!"
@gelendir
gelendir / jobsdead.py
Created September 11, 2011 22:12
Is steve jobs dead ?
#!/usr/bin/env python2
import urllib
import smtplib
import time
from HTMLParser import HTMLParser
from email.mime.text import MIMEText
SERVER = "smtp.gmail.com"
PORT = 587
@gelendir
gelendir / imgurdl.py
Created October 23, 2011 01:08
imgur album downloader
from html.parser import HTMLParser
from urllib import request
import os.path
import re
import json
import sys
class ImgListScraper( HTMLParser ):
<?php
$BASE_URL = "http://131.137.250.85/cgi-bin/qweb.dll";
$SCRIPT_NAME = basename(__FILE__);
function send_request($url, $body=null) {
$query = parse_url($url);