Skip to content

Instantly share code, notes, and snippets.

View fliphess's full-sized avatar

Flip Hess fliphess

View GitHub Profile
@fliphess
fliphess / gist:9123388
Last active August 29, 2015 13:56
openvpn htaccess authenthicator
#!/usr/bin/env python
# Thanks to https://github.com/tomekwojcik/flask-htauth/blob/master/flask_htauth/htpasswd.py
import argparse
import os
import sys
import base64
import codecs
import crypt
from hashlib import md5, sha1
import logging
@fliphess
fliphess / gist:4b82eafff2534d2ad027
Last active August 29, 2015 14:02
test all puppet recipes
#!/usr/bin/env python
import sys
import time
import os.path
import subprocess
import multiprocessing.pool as mpool
puppet = '/usr/bin/puppet'
results = []
start = time.time()
@fliphess
fliphess / release.sh
Last active August 29, 2015 14:20
Release and build a debian or ubuntu package using git-buildpackage and pbuilder
#!/bin/bash
set -e
TAG="$1"
TIMESTAMP="$(date "+%Y%m%d.%H%M%S")"
BRANCH="$( git branch | awk '{ print $NF }' )"
## If this is a development build, then set tag depending on last tag +1
if [ "${BRANCH}" == "develop" ] ; then
TAG="$( git tag -l | tail -n 1 )1"
# this is an rsync-excludes format list of files to exclude.
@fliphess
fliphess / magupdate.sh
Last active August 29, 2015 14:27
update magento to the latest version
#!/bin/bash
[ -f ./mage ]|| { echo "Mage not found! Exiting!"; exit 1; }
chmod +x mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage sync
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
php shell/indexer.php reindexall
@fliphess
fliphess / gist:9b1190335d22311037c2
Created November 25, 2015 09:02
Purge varnish on byte using cURL
curl -X PURGE --header 'Host: www.domein.nl' http://<loadbalancer ip>/.* -A "UserAgentString"
@fliphess
fliphess / install-wordpress.sh
Last active November 25, 2015 20:51
Install wordpress from the commandline using wordpress cli
#!/bin/bash
PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin'
INSTALL_WORDPRESS_EXTENSIONS=(
"better-wp-security"
"disqus-comment-system"
"redis-cache"
"wp-smushit"
"w3-total-cache"
"wp-optimize"
@fliphess
fliphess / tornado_basic_auth_bcrypt_add_user
Last active December 30, 2015 13:38
add users + passwords to passdb for tornado basic auth example
#!/usr/bin/env python
# for example itself see: https://gist.github.com/fliphess/7836469
import argparse
import bcrypt
import getpass
import sys
import os.path
import re
def parse_options():
@fliphess
fliphess / flush.php
Last active January 25, 2016 13:15
flush redis cache
<?php
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, proxy-revalidate');
echo "Flushing redis cache\n";
echo shell_exec('/usr/bin/redis-cli -n 0 "flushall"');
?>
@fliphess
fliphess / varnishstat.php
Last active February 1, 2016 12:16
Get varnishtop output on byte dedicated servers
<?php
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, proxy-revalidate');
$a = shell_exec('varnishstat -1');
echo "<pre>$a</pre>";
?>