This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# A hook script to check the commit log message. Called by "git commit" with | |
# one argument, the name of the file that has the commit message. The hook | |
# should exit with non-zero status after issuing an appropriate message if it | |
# wants to stop the commit. The hook is allowed to edit the commit message | |
# file. | |
# | |
test "" = "$(cat $1 | head -n1 | egrep -v '^[A-Z]+-[0-9]+\b')" || { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Does a fetch --prune of all repositories and lists all open pull requests | |
# | |
# Usage: | |
# `hello <github org>` | |
# | |
# Prep steps: | |
# 1) Ensure your git clones are in a subdirectory that matches your github org name | |
# 2) install jq from https://stedolan.github.io/jq/ (brew install jq) | |
# 3a) Create a GitHub Personal OAuth token on https://github.com/settings/tokens/new (with "repo" access) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Adds a bash function that grabs a password from the MacOS keychain. | |
# Usage: | |
# getFromKeychain <entryname> | |
getFromKeychain() { | |
echo $(security find-generic-password -ga "$1" 2>&1 >/dev/null | awk '/^password/{ print substr($2, 2, length($2) - 2) }') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.github.barend.getpid; | |
import com.sun.jna.Library; | |
import com.sun.jna.Native; | |
/** | |
* requires {@code jna.jar}. | |
* http://stackoverflow.com/a/7303433/49489 | |
*/ | |
public class GetPid { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Brew update everything and clean up afterwards. | |
alias broo='if [ -n "$VIRTUAL_ENV" ]; then; echo "FATAL: active virtualenv"; else; brew update && brew upgrade && brew cleanup -s; fi;' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git pull all the repos two levels under $PWD, 4 in parallel | |
# vim: ft=zsh: | |
function woohoo() { | |
git -C "$1" pull --ff-only --recurse-submodules=yes --quiet 2>&1 | |
if [ ! $? ]; then | |
echo "Failed: $1" 1>&2 | |
fi | |
} | |
export -f woohoo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following is the Black Female Astronaut emoji as encoded | |
in UTF8, shown in hex: | |
F0 9F 91 A9 F0 9F 8F BF E2 80 8D F0 9F 9A 80 byte value | |
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 byte number | |
As you can tell it's fifteen bytes. If you express the hex | |
digits in binary you can see how UTF8 encoding works, and | |
you can see it's made up of four characters. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Does cool things, with optional verbose output. | |
""" | |
import logging | |
log = logging.getLogger() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export KRB5CCNAME="FILE:$(mktemp)" | |
kinit -kt <keytab> <username> | |
# do stuff | |
kdestroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example; | |
import com.google.common.base.Charsets; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SecureRandom; | |
import java.util.Optional; | |
/** | |
* Example password wrapper class that obfuscates the in-memory password so | |
* that it doesn't appear in crash dumps in cleartext. This does nothing |