I hereby claim:
- I am barend on github.
- I am barend (https://keybase.io/barend) on keybase.
- I have a public key ASCB83tj3TtNwDtix1P2-b41Qt-_scb4bUKbw-XGJq5hSAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/bin/bash | |
| # Update all git repositories under PWD or $1 | |
| # Assumes basic `git clone` usage; may not work for more elaborate git layouts. | |
| BASEDIR="${1:-.}" | |
| SSH_KEY_NAME="..." # some distinguishing string from your ssh-add -l output | |
| SSH_KEY_FILE="..." # the filename of your SSH key | |
| if ssh-add -l | grep -F -q $SSH_KEY_NAME; then |
| import logging | |
| from time import gmtime | |
| # https://stackoverflow.com/a/7517430/49489 | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format="%(asctime)s.%(msecs)03dZ [%(name)s] %(message)s", | |
| datefmt="%Y-%m-%dT%H:%M:%S", | |
| ) | |
| logging.Formatter.converter = gmtime |
| 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 |
| export KRB5CCNAME="FILE:$(mktemp)" | |
| kinit -kt <keytab> <username> | |
| # do stuff | |
| kdestroy |
| #!/usr/bin/env python3 | |
| """ | |
| Does cool things, with optional verbose output. | |
| """ | |
| import logging | |
| log = logging.getLogger() | |
| 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. |
| # 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 |
| # 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;' |
| 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 { |