Skip to content

Instantly share code, notes, and snippets.

View barnumbirr's full-sized avatar

Martin Simon barnumbirr

View GitHub Profile
@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'
@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
@Ajnasz
Ajnasz / noemoji.pl
Created October 14, 2014 11:53
# Replace annoying emojis. You can see them on slack, for example.
# noemoji.pl
#
# Replace annoying emojis. You can see them on slack, for example.
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '1.0';
@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
@Lukewh
Lukewh / i3blocks config
Last active April 1, 2020 17:58
i3 bar for motivation in these times of working from home. Thanks https://gofuckingwork.com/
[motivation]
command=/path/to/motivation/script/motivation
interval=900
@joshenders
joshenders / certchain.sh
Last active August 26, 2021 18:19
Simple Bash function to visualize PKI chain-of-trust
function certchain() {
# Usage: certchain
# Display PKI chain-of-trust for a given domain
# GistID: https://gist.github.com/joshenders/cda916797665de69ebcd
if [[ "$#" -ne 1 ]]; then
echo "Usage: ${FUNCNAME} <ip|domain[:port]>"
return 1
fi
local host_port="$1"
@ryancdotorg
ryancdotorg / frag32.py
Created August 20, 2015 16:27
A FAT32 fragmenter, because I am a horrible person.
#!/usr/bin/env python
import random
import struct
import sys
# Most of the Fat32 class was cribbed from https://gist.github.com/jonte/4577833
def ppNum(num):
return "%s (%s)" % (hex(num), num)
@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: