Skip to content

Instantly share code, notes, and snippets.

View site_init.py
"""
Decorate SCons Environment constructor so that Homebrew paths are always included.
"""
from functools import wraps
import SCons.Environment
# Homebrew install directory
homebrew = '/opt/homebrew'
View gist:9009942
<?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 Jun 14, 2014
How to package your own mod_auth_openid 0.9 for Ubuntu
View package_mod_auth_openid.sh
#!/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 Jan 23, 2015
wget optimized for creating locally browseable archives
View sitecopy.sh
#!/bin/bash
wget \
--execute robots=off \
--no-check-certificate \
--mirror \
--html-extension \
--convert-links \
--backup-converted \
--page-requisites \
View parsekit
--- 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 / detect_wordexp.py
Last active Aug 29, 2015
Look for wordexp() imports on your $PATH
View detect_wordexp.py
#!/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
@SteelPangolin
SteelPangolin / pip-upgrade.sh
Created Apr 3, 2015
Upgrade all outdated packages managed by pip. Great for virtualenvs.
View pip-upgrade.sh
#!/bin/sh
pip list --outdated | cut -d ' ' -f 1 | xargs pip install -U
@SteelPangolin
SteelPangolin / README.md
Created Apr 7, 2015
Packer template for building a Debian-based AMI suitable for developing and running Python 3.4-based services
View README.md

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.
View Exploring is never boring.md
@SteelPangolin
SteelPangolin / xcom.py
Created May 12, 2015
Generate a random X-COM mission name.
View xcom.py
#!/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 = [
You can’t perform that action at this time.