Skip to content

Instantly share code, notes, and snippets.

"""
Decorate SCons Environment constructor so that Homebrew paths are always included.
"""
from functools import wraps
import SCons.Environment
# Homebrew install directory
homebrew = '/opt/homebrew'
<?php
function master()
{
$num_partitions = 10;
// not every system has this :(
//setproctitle("Parallel master: {$num_partitions} partitions");
$workers = [];
@SteelPangolin
SteelPangolin / package_mod_auth_openid.sh
Created June 14, 2014 17:37
How to package your own mod_auth_openid 0.9 for Ubuntu
#!/bin/bash
# Ubuntu version of package: http://packages.ubuntu.com/trusty/libapache2-mod-auth-openid
# FPM man page: https://github.com/jordansissel/fpm/wiki
# FPM instructions for autotools: https://github.com/jordansissel/fpm/wiki/PackageMakeInstall
# install build-time dependencies
# yes, apache2 is a build-time dependency, otherwise APXS breaks:
# "checking Apache version... configure: error: /usr/bin/apxs2 says that your apache binary lives at /usr/sbin/apache2 but that file isn't executable."
sudo aptitude -y install \
@SteelPangolin
SteelPangolin / sitecopy.sh
Created January 23, 2015 21:28
wget optimized for creating locally browseable archives
#!/bin/bash
wget \
--execute robots=off \
--no-check-certificate \
--mirror \
--html-extension \
--convert-links \
--backup-converted \
--page-requisites \
@SteelPangolin
SteelPangolin / detect_wordexp.py
Last active August 29, 2015 14:15
Look for wordexp() imports on your $PATH
#!/usr/bin/python
"""
Look for binaries on $PATH that use the wordexp() POSIX libc function.
Only looks at dynamically linked binaries.
Works on Mac OS X and Linux systems, Python versions 2.4 to 3.4.
"""
import subprocess
import os
import sys
--- a/parsekit-1.3.0/parsekit.c
+++ b/parsekit-1.3.0/parsekit.c
@@ -78,18 +78,18 @@
#ifdef IS_CV
/* PHP >= 5.1 */
} else if (node->op_type == IS_CV) {
- add_assoc_long(return_value, "var", node->u.var);
- add_assoc_stringl(return_value, "varname", op_array->vars[node->u.var].name, op_array->vars[node->u.var].name_len, 1);
+ add_assoc_long(return_value, "var", node->u.op.var);
+ add_assoc_stringl(return_value, "varname", op_array->vars[node->u.op.var].name, op_array->vars[node->u.op.var].name_len, 1);
@SteelPangolin
SteelPangolin / pip-upgrade.sh
Created April 3, 2015 03:39
Upgrade all outdated packages managed by pip. Great for virtualenvs.
#!/bin/sh
pip list --outdated | cut -d ' ' -f 1 | xargs pip install -U
@SteelPangolin
SteelPangolin / README.md
Created April 7, 2015 19:17
Packer template for building a Debian-based AMI suitable for developing and running Python 3.4-based services

This is a Packer template for building a Debian-based AMI suitable for developing and running Python 3.4-based services. It uses a Debian 8 prerelease image as the base.

To build the AMI:

  • Install Packer.
  • Make sure your Amazon credentials are in ~/.aws/credentials.
  • If using an AWS region other than Oregon, change region and source_ami in packer-template.json.
  • Run packer build packer-template.json.
@SteelPangolin
SteelPangolin / xcom.py
Created May 12, 2015 04:51
Generate a random X-COM mission name.
#!/usr/bin/env python3
"""
Generate a random X-COM mission name.
See http://xcom.wikia.com/wiki/Missions_%28XCOM:_Enemy_Unknown%29
and http://kotaku.com/5916411/why-all-of-xcom-enemy-unknowns-missions-sound-like-1980s-heavy-metal-albums
"""
from random import choice
prefixes = [