Skip to content

Instantly share code, notes, and snippets.

View mauritsvanrees's full-sized avatar

Maurits van Rees mauritsvanrees

View GitHub Profile
@mauritsvanrees
mauritsvanrees / buildout_extends_grabber.py
Last active October 26, 2023 23:24
Parse buildout.cfg and recursively download all extends files that are online
"""
Parse buildout.cfg and recursively download all extends files that are online
Usage::
python buildout_extends_grabber.py [url or path to buildout file]
Needs Python 3.7 or higher.
Examples::
@mauritsvanrees
mauritsvanrees / setuptools_subversion.py
Created October 19, 2011 15:18
Setuptools revision control system plugin for Subversion; taken from Martijn Pieters: http://pypi.python.org/pypi/setuptools_subversion
#!/usr/bin/env python
try:
from subprocess import CalledProcessError
CalledProcessError # pyflakes
except ImportError:
CalledProcessError = SystemError
from subprocess import PIPE
from distutils.log import warn
@mauritsvanrees
mauritsvanrees / nuke_trailing_white_space.sh
Created February 21, 2013 16:57
Nuke trailing white space in several types of file.
#! /bin/sh
echo "Nukes all trailing white space in *pt and *py and some other files."
FOR_REAL=0
if test $# -eq 1; then
if test $1 = "-y"; then
FOR_REAL=1
fi
fi
if test $FOR_REAL -eq 1; then
@mauritsvanrees
mauritsvanrees / gist:5669913
Last active December 17, 2015 20:48
$ curl -i http://pypi.python.org/simple/pep8/ # This run gives back gzipped html
HTTP/1.1 200 OK
Server: nginx/1.1.19
Content-Type: text/html; charset=utf-8
Content-encoding: gzip
Strict-Transport-Security: max-age=31536000
Cache-Control: max-age=3600, public
Via: 1.1 varnish
Content-Length: 829
Accept-Ranges: bytes
Date: Wed, 29 May 2013 12:26:04 GMT
local_authors.txt
authors.cfg
@mauritsvanrees
mauritsvanrees / gist:3a4feaf60b26547bbb86
Created June 17, 2014 22:38
Open a Zope FileStorage at a specific date and time, and copy that state to a new file. May give POSKeyError though.
import ZODB.FileStorage
import logging
import sys
from ZODB.TimeStamp import TimeStamp
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('truncate')
if len(sys.argv) != 4:
print("Usage: %s <source-filestorage> <target-filestorage> "
@mauritsvanrees
mauritsvanrees / keybase.md
Created January 13, 2015 21:39
Proof myself for keybase.io

Keybase proof

I hereby claim:

  • I am mauritsvanrees on github.
  • I am mauritsvanrees (https://keybase.io/mauritsvanrees) on keybase.
  • I have a public key whose fingerprint is 63C2 2569 E48E D8FB 0067 E5BB 7AE1 712D C8E7 0923

To claim this, I am signing this object:

@mauritsvanrees
mauritsvanrees / blobdownload.py
Created March 31, 2015 09:15
Proof of concept for downloading blobs from relstorage. Use at your own risk.
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2015 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@mauritsvanrees
mauritsvanrees / blobchunkcleanup.py
Last active August 29, 2015 14:18
Proof of concept for downloading and deleting blob chunks from RelStorage. Use at your own risk.
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2015 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@mauritsvanrees
mauritsvanrees / grabversions.py
Last active November 13, 2015 20:18
Grab version files from dist.plone.org for each Plone version.
"""Grab version files from dist.plone.org for each Plone version.
Original location:
https://gist.github.com/mauritsvanrees/99cb4a25b622479e7dc3
Goal: grep through these files to see which version of a package is
used in which Plone version.
Usage:
$ virtualenv-2.7 .