Skip to content

Instantly share code, notes, and snippets.

View fliphess's full-sized avatar

Flip Hess fliphess

View GitHub Profile
@fliphess
fliphess / tornado basic auth
Last active February 22, 2020 22:35
basic auth with "htpasswd" file - auth example for tornado webserver
#!/usr/bin/env python
# also check https://gist.github.com/fliphess/7836479
import tornado.ioloop
import tornado.web
import base64
import netaddr
import bcrypt
def require_basic_auth(handler_class):
@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 / 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 / multiple domains.php
Last active December 14, 2016 10:10
byte flush varnish when on a varnish cluster
<?php
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
$domains = array('devguppie.com', 'wwww.devguppie.com', 'www.example.com', 'example.com');
foreach ($domains as $domain) {
$curl = curl_init("http://$domain/.*");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PURGE");
curl_exec($curl);
curl_close($curl);
}
@fliphess
fliphess / sync-ssh-agent-keys.sh
Last active February 11, 2017 23:06
Script to put your ssh key on the hypernode vagrant
#!/bin/bash
TMPFILE="$( mktemp )"
## Test if there are keys loaded in the SSH agent
if (ssh-add -l | grep -q "The SSH agent has no identities" ) ; then
echo "Please add some keys to your ssh agent first!"
exit 1
fi
## Get all keys from SSH agent
@fliphess
fliphess / create-ubuntu-build-environment.sh
Last active January 27, 2020 21:40
Setup an ubuntu build environment with git-pbuilder
#!/bin/bash
# This script installs a basic build environment for debian/ubuntu
ACTION="${1}"
ARGS="${#}"
UBUNTU_VERSION="trusty"
INSTALL_PACKAGES=(
apt-file
cdebootstrap
@fliphess
fliphess / build-ubuntu-package.sh
Created May 9, 2015 01:53
Build ubuntu package
#!/bin/bash
set -e
echo "Building package"
git-buildpackage --git-pbuilder --git-ignore-branch --git-dist=trusty --git-arch=amd64
@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"
@fliphess
fliphess / create-debian-build-environment.sh
Last active August 21, 2021 19:23
Setup an debian build environment with git-pbuilder
#!/bin/bash
# This script installs a basic build environment for debian
ACTION="${1}"
ARGS="${#}"
DEBIAN_VERSION="unstable"
INSTALL_PACKAGES=(
apt-file
cdebootstrap