Skip to content

Instantly share code, notes, and snippets.

SteelPangolin / mkdtemp.php
Created Nov 29, 2011
fake mkdtemp() for PHP
View mkdtemp.php
* Create a directory in the system temp directory with a hard-to-predict name.
* Does not have the guarantees of the actual BSD libc function or Python tempfile function.
* @param string $suffix Append to the new directory's name
* @param string $prefix Prepend to the new directory's name
* @return string The path of the new directory.
function mkdtemp($suffix = '', $prefix = 'tmp')
SteelPangolin / rmtree.php
Created Nov 30, 2011
shutil.rmtree for PHP
View rmtree.php
* Delete a file or directory recursively.
* @param string $path
function rmtree($path)
if (is_dir($path))
SteelPangolin / lsflags.c
Created Oct 2, 2012
lsflags: complementary utility to chflags. List flags for Mac OS X files and folders.
View lsflags.c
// compile with gcc -std=c99 -Wall lsflags.c -o lsflags
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/stat.h>
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
function master()
$num_partitions = 10;
// not every system has this :(
//setproctitle("Parallel master: {$num_partitions} partitions");
$workers = [];
SteelPangolin /
Created Jun 14, 2014
How to package your own mod_auth_openid 0.9 for Ubuntu
# Ubuntu version of package:
# FPM man page:
# FPM instructions for autotools:
# 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 / Main.hs
Created Jan 20, 2015
Install Mac version of UT2004 from PC discs and Mac demo
View Main.hs
module Main where
Utility to automatically install and patch the Mac OS X version
of Unreal Tournament 2004 from the Mac demo and patcher
and PC installation disc images and CD key.
Can automatically download the demo and patcher.
SteelPangolin /
Created Jan 23, 2015
wget optimized for creating locally browseable archives
wget \
--execute robots=off \
--no-check-certificate \
--mirror \
--html-extension \
--convert-links \
--backup-converted \
--page-requisites \
SteelPangolin / EC2-Describe-IAM-policy.json
Created Jan 30, 2015
Get an Amazon Elastic Beanstalk environment's name from inside one of its instances
View EC2-Describe-IAM-policy.json
"Version": "2012-10-17",
"Statement": [
"Action": [
"Effect": "Allow",
"Resource": "*"
SteelPangolin /
Last active Aug 29, 2015
Look for wordexp() imports on your $PATH
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