Skip to content

Instantly share code, notes, and snippets.

@mgedmin
mgedmin / github_mirror.py
Last active April 12, 2026 09:05
Mirror all my github repositories and gists
#!/usr/bin/env python3
# See http://stackoverflow.com/questions/3581031/backup-mirror-github-repositories/13917251#13917251
# You can find the latest version of this script at
# https://gist.github.com/4319265
import os
import sys
import json
import urllib.request
import subprocess
@mgedmin
mgedmin / watchpos.py
Created December 17, 2012 18:16
Hack to monitor file position of an app that doesn't have any built-in progress indication
#!/usr/bin/python
"""
Usage: watchpos {filename|pid fd}
Watches the file pointer of an opened file on Linux. Use it to provide a
progress bar to a command that doesn't have one, assuming the program reads
this file from start to end without jumping around.
Copyright (c) 2011 Marius Gedminas <marius@gedmin.as>
@mgedmin
mgedmin / timeline.py
Last active October 10, 2019 12:34
Visualize a Zope trace.log with d3.js
#!/usr/bin/python3
"""
Show recent requests on a timeline
Parses a ZServer trace.log file. The format is documented at
https://pypi.python.org/pypi/zc.zservertracelog
"""
import json
import re

zope-test-janitor

This is a script that analyzes Zope test summary emails and produces an HTML report.

Mutt users: pipe (|) the email to zope-test-janitor, enjoy output in your browser.

screenshot.png

#!/usr/bin/python3
import json
import os
import subprocess
import urllib.request
import sys
from operator import itemgetter
@mgedmin
mgedmin / buildout-tags.sh
Last active December 14, 2015 21:38
Create ctags for the current virtualend or buildout
#!/bin/bash
# Build a vim tags file for all the Python packages in the buildout path
# Assumes . is the directory with a buildout.cfg
# Note: there is no one true buildout path -- every part has its own. So
# we look for a python interpreter in bin/python (or bin/py) and use its path.
# If that fails, we try to find a bin/test script and scrape the path from it.
# Should also work with virtualenv (just run it somewhere with a bin/python)
# Published at https://gist.github.com/mgedmin/5152189
progname=${0##*/}
@davidfraser
davidfraser / OfficeCleaner.py
Created March 19, 2013 08:24
Clean up XHTML by removing extraneous things - in particular those generated by copying and pasting out of Microsoft Office products
import cssutils
from xml.sax import saxutils
from lxml.html import tostring, fromstring, clean
from lxml import etree
import logging
class Cleaner(clean.Cleaner):
def clean_html(self, html):
if not isinstance(html, unicode):
@mgedmin
mgedmin / virtual-bootstrap.sh
Created March 22, 2013 10:30
Shell script to bootstrap a package that uses zc.buildout, wrapped in a virtualenv for site isolation
#!/bin/bash
if [ "${0##*/}" == "virtual-bootstrap-py3" ]; then
python=python3.3
else
python=python2.7
fi
if [ -n "$(netstat -tnl | grep ':3128 ')" ]; then
export http_proxy=http://localhost:3128
echo "Using a local Squid proxy."
fi
@rygorous
rygorous / gist:5312588
Created April 4, 2013 17:59
GDraw extension wrangling
///////////////////////////////////////////////////////////////////////////////
//
// Extensions (we map to GL 2.0 function names for a uniform interface
// across platforms)
//
#define GDRAW_GL_EXTENSION_LIST \
/* identifier import procname */ \
/* GL_ARB_multitexture */ \
GLE(ActiveTexture, "ActiveTextureARB", ACTIVETEXTUREARB) \
@juliepagano
juliepagano / 101_off_limits.md
Last active December 16, 2020 09:37
101 conversations I generally don't want to have...

This list now exists over at http://juliepagano.com/blog/2013/11/02/101-off-limits/ and will be updated there.

I keep saying that impromptu, unwanted feminism 101 discussions are exhausting and not a good use of my resources. Then people ask what I mean by 101, so I'm starting to make a list. This list will change over time - I recommend checking back.

I highly recommend checking this list before engaging with me about feminism if you're new to it. It'll save both of us a lot of time and frustration.

Diversity in tech

Women aren't equally represented in tech because biology

Nope. This argument is bad and the science does not support it. Unfortunately, every time you say this out loud, you are contributing to cultural problems that do decrease the number of women in tech.