Skip to content

Instantly share code, notes, and snippets.

@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
@SteelPangolin
SteelPangolin / EC2-Describe-IAM-policy.json
Created January 30, 2015 21:23
Get an Amazon Elastic Beanstalk environment's name from inside one of its instances
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:Describe*"
],
"Effect": "Allow",
"Resource": "*"
}
@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 / Main.hs
Created January 20, 2015 00:51
Install Mac version of UT2004 from PC discs and Mac demo
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.
see: http://lowetechlabs.com/UT2004-WIN2OSX/
see: http://forums.macnn.com/showthread.php?t=292620
@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 \
<?php
function master()
{
$num_partitions = 10;
// not every system has this :(
//setproctitle("Parallel master: {$num_partitions} partitions");
$workers = [];
"""
Decorate SCons Environment constructor so that Homebrew paths are always included.
"""
from functools import wraps
import SCons.Environment
# Homebrew install directory
homebrew = '/opt/homebrew'
@SteelPangolin
SteelPangolin / lsflags.c
Created October 2, 2012 23:48
lsflags: complementary utility to chflags. List flags for Mac OS X files and folders.
// 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>
@SteelPangolin
SteelPangolin / rmtree.php
Created November 30, 2011 00:19
shutil.rmtree for PHP
<?php
/**
* Delete a file or directory recursively.
* @param string $path
*/
function rmtree($path)
{
if (is_dir($path))
{
@SteelPangolin
SteelPangolin / mkdtemp.php
Created November 29, 2011 23:57
fake mkdtemp() for PHP
<?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')