Skip to content

Instantly share code, notes, and snippets.

View glenbot's full-sized avatar

Glen Zangirolami glenbot

View GitHub Profile
@glenbot
glenbot / gist:e825ce14f06dc198926e
Last active August 29, 2015 14:01
Stress test websites
#!/usr/bin/env python
"""
Stress test a web site
Usage:
stress_test_replay [options]
Options:
--host=<host> The host to connect to [default: http://www.example.com].
@glenbot
glenbot / start_package
Created August 19, 2014 18:59
Utility to help bootstrap python packages
#!/bin/bash
# A shell utility to help bootstrap python packages
# Author: Glen Zangirolami
# https://github.com/glenbot
set -o nounset
set -o errexit
# Check for dependencies
function check_dependencies() {
local GIT_INSTALLED=$(which git)
<syntaxColor id="CodeColor_DjangoTemplateFilter" text="#5C4B5E" />
<syntaxColor id="CodeColor_DjangoTemplateTag" text="#5C4B5E" />
<syntaxColor id="CodeColor_DjangoTemplateBlockTag" text="#999999" bold="true" />
<syntaxColor id="CodeColor_DjangoTemplateVariable" text="#999999" bold="true" />
<syntaxColor id="CodeColor_DjangoTemplateString" text="#99CC66" />
<syntaxColor id="CodeColor_DjangoTemplateIdentifier" text="#B8A484" />
<syntaxColor id="CodeColor_DjangoTemplateOperator" text="#993333" />
<syntaxColor id="CodeColor_DjangoTemplateNumbers" text="#993333" />
@glenbot
glenbot / solr_queue_backen.py
Created December 15, 2011 03:31
Solr Queue Backend for haystack
import logging
import sys
import time
from threading import Thread
from Queue import Queue
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models.loading import get_model
from haystack.backends import BaseSearchBackend, BaseSearchQuery, log_query, EmptyResults
from haystack.constants import ID, DJANGO_CT, DJANGO_ID
@glenbot
glenbot / launch_requestbin.py
Created May 4, 2012 13:26
Bootstrap file to run Requestbin locally
import os
from requestbin.web import app
from requestbin.service import RequestBin
from requestbin.storage.memory import MemoryStorage
request_bin = RequestBin()
request_bin.do_start()
app.config['bind_address'] = ('0.0.0.0', int(os.environ.get("PORT", 5000)))
@glenbot
glenbot / debian_os_meta.sh
Created June 7, 2012 19:05
Detect debian operating system
#!/bin/bash
# Try and get debian operating system
# id, codename, and release
get_debian_os_meta() {
OS=$(uname)
ID="unknown"
CODENAME="unknown"
RELEASE="unknown"
@glenbot
glenbot / gitswitcher.sh
Created November 5, 2012 15:20
Switch git context in shell
#!/bin/bash
# Configuration files
TEMP_CONFIG="/tmp/gitswitchrc"
ALT_SSH_CONF="$HOME/.ssh/id_rsa_gitswitch"
BASHRC="$HOME/.bashrc"
# PS1 prompt pre-text
# Places some text behind your command prompt to give
# a context clue that you are within another GIT context.
@glenbot
glenbot / due_dates.py
Last active December 10, 2015 14:08
Due Date Notifier - Notify VIA SMS (SendHub) when a bill is going to be due
#!/usr/bin/env python
# Due Date Notifier - Notify VIA SMS (SendHub) when a bill is going to be due
# * Requires a SendHub account (free) - http://sendhub.com
# * Has python package dependencies: simplejson, requests
# * Recommend putting this on a crob job running once a day
# I like my text messages at at 11am
#
# NOTE: Sendhub free accounts allow only 500 requests to the API per month.
# This should suffice assuming the amount of bills you pay arent loco.
#
@glenbot
glenbot / Git Issue Export for Pivotal
Created January 6, 2011 23:57
Export your open issues in github to a pivotal tracker friendly csv for import, requires github2 python api-client
import csv
from github2.client import Github
# api settings for github
git_username = 'your_git_username'
git_api_token = 'your_git_api_token'
git_repo = 'username/repo_name'
# import all issues as this story type
pivotal_story_type = 'Bug'
@glenbot
glenbot / debug.txt
Last active May 2, 2017 20:53
Debug output packer bug
2017/05/02 15:39:47 [INFO] Packer version: 1.0.0
2017/05/02 15:39:47 Packer Target OS/Arch: darwin amd64
2017/05/02 15:39:47 Built with Go Version: go1.8
2017/05/02 15:39:47 [DEBUG] Discovered plugin: amazon-chroot = <redacted>/bin/packer-builder-amazon-chroot
2017/05/02 15:39:47 [DEBUG] Discovered plugin: amazon-ebs = <redacted>/bin/packer-builder-amazon-ebs
2017/05/02 15:39:47 [DEBUG] Discovered plugin: amazon-instance = <redacted>/bin/packer-builder-amazon-instance
2017/05/02 15:39:47 [DEBUG] Discovered plugin: digitalocean = <redacted>/bin/packer-builder-digitalocean
2017/05/02 15:39:47 [DEBUG] Discovered plugin: docker = <redacted>/bin/packer-builder-docker
2017/05/02 15:39:47 [DEBUG] Discovered plugin: file = <redacted>/bin/packer-builder-file
2017/05/02 15:39:47 [DEBUG] Discovered plugin: googlecompute = <redacted>/bin/packer-builder-googlecompute