Skip to content

Instantly share code, notes, and snippets.

View whiteinge's full-sized avatar

Seth House whiteinge

View GitHub Profile
@whiteinge
whiteinge / gevent_server.py
Last active December 20, 2015 10:31
Bare WSGI app for testing gevent streaming
#!/usr/bin/env python
'''
'''
# from gevent import monkey
# monkey.patch_all()
import os
import itertools
from time import sleep
@whiteinge
whiteinge / FreeBSD 10.1
Last active September 15, 2016 19:29
Salt Grains examples for a variety of platforms
{
"jutt_freebsd": {
"biosversion": "4.1.5",
"kernel": "FreeBSD",
"domain": "",
"uid": 0,
"zmqversion": "4.1.5",
"kernelrelease": "10.1-RELEASE-p15",
"pythonpath": [
"/usr/local/bin",
@whiteinge
whiteinge / formula-util.sh
Last active June 28, 2017 16:45
Functions to more easily work with a ton of organization repos
#!/bin/bash
# Functions to more easily work with a ton of organization repos
#
# Requires ok.sh and Git.
#
# Available commands: ${ALL_FUNCS}
# Lazyness!
ok="$(which ok.sh)"
eval "$(awk '$0 ~ /^_helptext/, /^}/ { print }' $ok)"
@whiteinge
whiteinge / saltshell.py
Last active November 30, 2016 01:29
The planning stages of a for-development shell environment for Salt
#!/usr/bin/env python
'''\
Welcome to the Salt repl which exposes the execution environment of a minion in
a pre-configured Python shell
__opts__, __salt__, __grains__, and __pillar__ are available.
Jinja can be tested with full access to the above structures in the usual way:
JINJA("""\\
@whiteinge
whiteinge / selfinstaller.bzx
Last active August 29, 2015 13:56
Self-extracting RPM installer
#!/bin/sh
# A self-extracting installer for RPMs
#
# Requires: POSIX env, base64, and mktemp.
#
# To create: make a gzip-compressed tarball of RPMs (with no subdirectory),
# convert to base64, then concatenate onto the end of this file::
#
# cd /some/directory/of/rpm/files
# tar -cz *.rpm | base64 -w0 >> selfinstaller.bzx
@whiteinge
whiteinge / sample_cherrypy.py
Last active October 30, 2021 00:22
A not-so-simple but minimal example of a CherryPy app.
#!/usr/bin/env python
# coding: utf-8
'''
A minimal but thorough example of a CherryPy app.
'''
import cherrypy
class Root(object):
@cherrypy.expose
def index(self):
@whiteinge
whiteinge / connected_ips.awk
Last active February 20, 2022 23:12
Output IP addresses for machines connected to the local machine using /proc/net/tcp for speed
#!/usr/bin/awk -f
# Output IP addresses for machines that are connected to the local machine.
#
# Usage:
# ./connected_ips.awk /proc/net/tcp
# ./connected_ips.awk -v port=4505 /proc/net/tcp
function fromhex(s){
# Amazing voodoo from William.
# http://compgroups.net/comp.lang.awk/reading-hexadecimal-numbers/33952
@whiteinge
whiteinge / keybase.md
Created April 10, 2014 23:23
keybase.md

Keybase proof

I hereby claim:

  • I am whiteinge on github.
  • I am whiteinge (https://keybase.io/whiteinge) on keybase.
  • I have a public key whose fingerprint is 22CA 731F 6E18 4DA6 A087 7EA5 981A 9910 15ED 347D

To claim this, I am signing this object:

@whiteinge
whiteinge / eventlisten.sh
Last active August 30, 2017 18:37
A POSIX sh implementation of Salt's eventlisten.py script. Uses salt-api's event HTTP stream.
#!/bin/sh
URL="http://localhost:8000"
COOKIES="cookies.txt"
fnmatch () { case "$2" in $1) return 0 ;; *) return 1 ;; esac ; }
listen() {
# Watch Salt's events HTTP stream.
@whiteinge
whiteinge / vcs_info-hook-optional-rev
Last active August 29, 2015 14:04
Example of a hook for vcs_info for optionally displaying the git revision
# Toggle this to test the hook
zstyle ':vcs_info:git:*' get-revision true
# basic 'formats' config: (git)[hash] branch
zstyle ':vcs_info:git*' formats "(%s)%i %b"
# Register new hook
zstyle ':vcs_info:git*+set-message:*' hooks git-optional-rev
# Define new hook