Skip to content

Instantly share code, notes, and snippets.

View gear11's full-sized avatar

Andy Jenkins gear11

View GitHub Profile
#!/bin/sh
# The current Google container-optimized image starts Docker before this startup
# script gets a chance to run, so our mounts may not be set, etc.
# Kill the docker agent and containers that have started already.
ps -u root -o pid,cmd | grep docker-agent | perl -pe 's/\s*(\d+).*/$1/' | xargs -I {} kill -9 {};
docker ps -q | xargs -I {} docker rm -f {};
# Mount the MongoDB disk, which should have been attached by the instance create command
mkdir /mnt/pd1
mount -t ext4 /dev/disk/by-id/google-mongodb-data-1 /mnt/pd1
# Ensure MongoDB has somewhere to write its data, even if the disk is empty
@gear11
gear11 / wpdownloadrc-gear11.txt
Created May 12, 2014 12:02
wp-download configuration for downloading just the English article text.
# wpdownloadrc.sample
#
# This file specifies which files should be downloaded from wikimedia
#
# Copy it to ~/.wpdownloadrc and adjust it to fit your needs.
[Configuration]
# base_url (string)
# -----------------
@gear11
gear11 / main.py
Created December 17, 2013 14:54
Simple Python proxy server based on Flask and Requests. See: http:/python-proxy-server/gear11.com/2013/12/python-proxy-server/
"""
A simple proxy server. Usage:
http://hostname:port/p/(URL to be proxied, minus protocol)
For example:
http://localhost:8080/p/www.google.com
"""