Skip to content

Instantly share code, notes, and snippets.

@poke
poke / mailserver.py
Last active May 15, 2018 10:07
Simple debug mail server
#!/usr/bin/env python3
import argparse
import asyncore
import email.header
import email.parser
import smtpd
def decodeHeader (value):
return email.header.make_header(email.header.decode_header(value))
@poke
poke / stackexchange-chat-mass-unstar.user.js
Last active February 8, 2018 23:21
[User script] StackExchange Chat: Mass-unstar from the star list
// ==UserScript==
// @id stackexchange-chat-mass-unstar@poke
// @name StackExchange Chat: Mass-unstar from the star list
// @namespace poke
// @version 1.2.0
// @author Patrick Westerhoff
// @include *://chat.stackoverflow.com/rooms/info/*
// @include *://chat.stackexchange.com/rooms/info/*
// @include *://chat.meta.stackexchange.com/rooms/info/*
// @homepageURL https://gist.github.com/poke/ab25d627b2c4b02db6b8
@poke
poke / stackexchange-chat-unstar-transcript.user.js
Last active August 29, 2015 14:07
[User script] StackExchange Chat: Unstar from transcript
// ==UserScript==
// @id stackexchange-chat-unstar-transcript@poke
// @name StackExchange Chat: Unstar from transcript
// @namespace poke
// @version 1.0.0
// @author Patrick Westerhoff
// @include http://chat.stackoverflow.com/transcript/*
// @homepageURL https://gist.github.com/poke/d1fd6b5227efc5885cac
// @updateURL https://gist.githubusercontent.com/poke/d1fd6b5227efc5885cac/raw/stackexchange-chat-unstar-transcript.user.js
// @run-at document-end
@poke
poke / stackexchange-election-primary-counter.user.js
Last active March 12, 2019 20:48
[User script] StackExchange Election: Primary counter – Support on Stack Apps: http://stackapps.com/questions/4548
// ==UserScript==
// @id stackexchange-election-primary-counter@poke
// @name StackExchange Election: Primary counter
// @namespace poke
// @version 1.5.2
// @author Patrick Westerhoff
// @match *://*.stackoverflow.com/election*
// @match *://*.stackexchange.com/election*
// @match *://*.askubuntu.com/election*
// @match *://*.mathoverflow.net/election*
@poke
poke / connect-four.py
Created October 11, 2013 13:39
A simple Connect Four game in Python.
#! /usr/bin/env python3
from itertools import groupby, chain
NONE = '.'
RED = 'R'
YELLOW = 'Y'
def diagonalsPos (matrix, cols, rows):
"""Get positive diagonals, going from bottom-left to top-right."""
for di in ([(j, i - j) for j in range(cols)] for i in range(cols + rows -1)):
@poke
poke / gist:5627036
Created May 22, 2013 12:01
Guild Wars 2 API example using RestSharp
using RestSharp;
using System;
using System.Collections.Generic;
namespace Gw2ApiExample
{
class Program
{
public static void Main()
{
@poke
poke / Include-committer-name-in-last-change.patch
Created July 9, 2012 13:15
[PATCH] GitWeb: Include committer name in last change.
From: Patrick Westerhoff <PatrickWesterhoff@gmail.com>
Date: Mon, 9 Jul 2012 14:07:28 +0200
Subject: [PATCH] Include committer name in last change.
diff --git a/gitweb.cgi b/gitweb.cgi
index 2bd0d29..fbb1659 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -3170,9 +3170,10 @@ sub git_get_last_activity {
close $fd or return;
@poke
poke / SvnDumpToolEdit.py
Created October 8, 2010 01:49
SvnDumpToolEdit: SVN Dump content editor
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
SvnDumpToolEdit: SVN Dump content editor
SvnDumpToolEdit is a small script that allows to change single file nodes
within an SVN dump file. It automatically updates the Content-length attribute
for nodes and generates a new MD5 checksum when a file is changed. This ensures
that the SVN dump will always remain a valid dump file.