Skip to content

Instantly share code, notes, and snippets.

View alexander-bauer's full-sized avatar

Alexander Bauer alexander-bauer

  • Baltimore, Maryland
View GitHub Profile
@alexander-bauer
alexander-bauer / netshoot.sh
Created December 12, 2022 05:42
Open a netshoot (nmap + tcpdump + wireshark) container on Kubernetes with host networking
#!/bin/bash
kubectl run -it --rm --overrides='{"spec": {"hostNetwork": true}}' --image nicolaka/netshoot:latest netshoot -- bash
@alexander-bauer
alexander-bauer / post-receive
Created November 12, 2016 18:09
Git post-receive hook for updating a non-bare repository when pushed to
THISFILE="$(pwd)/$0"
REPODIR=$(dirname $(dirname $(dirname "$THISFILE")))
# Notify the user that we are updating HEAD.
echo -e "\033[32m"
echo "Updating HEAD for you."
echo git --git-dir "$REPODIR/.git" --work-tree "$REPODIR/" reset --hard master
echo -e "\033[0m"
git --git-dir "$REPODIR/.git" --work-tree "$REPODIR/" reset --hard master
@alexander-bauer
alexander-bauer / peekable.py
Last active September 16, 2021 20:03
Peekable iterator wrapper in Python3
class Peekable():
"""An iterable class which can return the next element of the wrapped
iterator without advancing it."""
def __init__(self, iterator):
self.iterator = iterator
self.peeked = False
def peek(self):
if not self.peeked:
self.peeked = True
We couldn’t find that file to show.
@alexander-bauer
alexander-bauer / keybase.md
Last active August 29, 2015 14:16
keybase.md

Keybase proof

I hereby claim:

  • I am alexander-bauer on github.
  • I am alexanderbauer (https://keybase.io/alexanderbauer) on keybase.
  • I have a public key whose fingerprint is C1B8 130E 68FA 7080 C99C 2504 8191 E21A 76AA D89B

To claim this, I am signing this object:

@alexander-bauer
alexander-bauer / .gitignore
Last active August 29, 2015 14:01
Create printable LTO3 barcode labels with specific parameters
*.ps
*~
*#*
#!/bin/sh
#
## convert.sh
#
# This script is used to convert all of the WAV audio files of a given
# artist/album pair to a different encoding.
#
# usage:
# convert.sh [artist] [album]
@alexander-bauer
alexander-bauer / blog
Last active December 20, 2015 16:18
Small utility for composing trofaf blogposts
#!/bin/bash
#
## blog
#
# This script creates a temporary file with [trofaf][] header data and
# opens it with an editor. When this is saved and closed, the file is
# moved to a particular directory with a title given either as the
# first argument, or read on the command line after completion.
#
# Once the file has been successfully renamed to markdown, if REGENDIR
@alexander-bauer
alexander-bauer / downloadkey.sh
Created May 3, 2013 20:53
This script uses simple utilities to download a GPG public key over http and import it to the keyring.
#!/bin/bash
## downloadkey.sh
##
## © 2013 Alexander Bauer, released under GPL-3+
## The full text of GPL-3 can be found in /usr/share/common-licenses
##
#
# This script uses simple utilities to download a GPG public key over
# http and import it to the keyring.
#
@alexander-bauer
alexander-bauer / work
Created April 23, 2013 20:35
work is a small script which attaches to a particularly named tmux session if available, and creates it if not.
#!/bin/sh
## work is written by Alexander Bauer and released under GPL 3+, the
## full text of which can be found in /usr/share/common-licenses.
#
# The purpose of this script is to attach to a tmux session of a
# particular name if it exists, or create it if it does not.
#
# SESSION is the name of the tmux session.
SESSION="$USER-work"