Skip to content

Instantly share code, notes, and snippets.

View barnumbirr's full-sized avatar

Martin Simon barnumbirr

View GitHub Profile
@stefanv
stefanv / sparks.py
Created November 17, 2011 00:25
Command line sparks in Python
#!/usr/bin/python
# coding=utf-8
# Python version of Zach Holman's "spark"
# https://github.com/holman/spark
# by Stefan van der Walt <stefan@sun.ac.za>
"""
USAGE:
@lukaslundgren
lukaslundgren / python27_on_debian.sh
Created May 11, 2012 12:58
How to install python 2.7 on debian
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xzf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=/usr --enable-shared
make
sudo make install
cd ..
@jamiesun
jamiesun / daemon.py
Created July 12, 2012 10:20
一个python守护进程的例子
#! /usr/bin/env python2.7
#encoding:utf-8
#@description:一个python守护进程的例子
#@tags:python,daemon
import sys
import os
import time
import atexit
from signal import SIGTERM
@quarnster
quarnster / dns.py
Created November 1, 2012 18:04
A tiny python dns proxy script
# Based on code originally from http://code.activestate.com/recipes/491264-mini-fake-dns-server/
#
# DNS rfc: http://www.ietf.org/rfc/rfc1035.txt
# http://en.wikipedia.org/wiki/List_of_DNS_record_types
import socket
import re
import sys
import traceback
import struct
import Queue
@mutsuda
mutsuda / mine_time.py
Last active December 15, 2015 15:38
This piece of code will keep track of a user's Minecraft gameplay minutes. Each time it is runed it writes into a log file the difference between the latest minutes with the actual minutes to obtain the total number of minutes played since the last execution.
import re
import os.path
import datetime
import os
import time
# Path to the minecraft statistics file
mine_path = "FULL_PATH_TO_/stats_user_unsent.dat"
@Svenito
Svenito / houchangelog.py
Created April 18, 2013 10:14
Script gets the changes between two build versions of Houdini from the journal and outputs them in a more traditional changelog format. Be sensible with how much data you want to get! Requires the Beautiful soup and requests libraries
#!/usr/bin/env python2.7
from BeautifulSoup import BeautifulSoup
from textwrap import TextWrapper
import requests
import collections
import sys
import re
@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active February 23, 2023 15:03
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@maliubiao
maliubiao / ezip.py
Created February 6, 2014 16:05
ezip.py, handle encoded filename in a zip file.
import zipfile
import sys
import os.path
import errno
def files_in_zip(this_zip, encoding):
return [x.decode(encoding) for x in zipfile.ZipFile(this_zip).namelist()]
def extract_all_encoding(this_zip, path_prefix, encoding):
z = zipfile.ZipFile(this_zip)
@barnumbirr
barnumbirr / viedemerde.py
Last active August 29, 2015 14:00
Parse viedemerde.fr for a random quote.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import urllib
__title__ = 'viedemerde'
__version__ = '0.1'
__author__ = 'Martin Simon <me@martinsimon.me>'
__license__ = 'Apache v2.0 License'