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
We couldn’t find that file to show.
@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
@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 / 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