This file contains 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 perl | |
# BUG: "#" can not appear in a value | |
BEGIN { @INC = grep {$_ ne '.'} @INC }; | |
use warnings; | |
use strict; | |
# XXX: make these overrideable with getopt, together with "rebuild all", etc. | |
my $flat_dir = '/etc/mail/flat'; |
This file contains 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
function prompt_query_ssh_status { | |
local suffix oIFS ss keycount | |
local -a keylines | |
if [[ -z ${SSH_AUTH_SOCK:-} ]]; then print "n/a"; return; fi | |
suffix=R | |
[[ -n ${SSH_AGENT_PID:-} ]] && suffix=L | |
if [[ $OSTYPE == darwin* ]]; then | |
case $SSH_AUTH_SOCK in | |
(/tmp/launch-*) suffix=D ;; |
This file contains 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 -eu | |
# http://www.keylength.com/en/3/ -- ECRYPT II "smallest general purpose level" | |
# is 1248 bits symmetric; we're pretty stuck on RSA right now | |
: "${KEYSIZE_RSA:=1248}" | |
: "${DKIM_SIGN_DOMAINS_FILE:=/etc/exim/dkim/domains-mapping}" | |
: "${DATE:=$(date +%Y%m)}" | |
declare -r KEYSIZE_RSA DKIM_SIGN_DOMAINS_FILE DATE |
This file contains 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
topleft="$(tput cup 0 0)"; nl="$(tput el)"$'\n'; invis="$(tput civis)"; vis="$(tput cvvis)" | |
push="$(tput sc)"; pop="$(tput rc)" | |
PS1="${topleft}%F{green}%D{%D %r}%f${nl}%~${nl}%# " | |
eval "TRAPUSR1() { print -Pn '${push}${invis}${topleft}%F{green}%D{%D %r}%f${nl}${pop}${vis}' }" | |
unset topleft nl invis vis push pop | |
p=$$; while sleep 1; do kill -s USR1 $p || exit; done &! unset p | |
# modified to do "|| exit" after the kill, so that if the kill fails, the child exits, so when parent dies, child will too. | |
# center-align version |
This file contains 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
// Copyright © 2017 Pennock Tech, LLC. | |
// All rights reserved, except as granted under license. | |
// | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are met: | |
// | |
// 1. Redistributions of source code must retain the above copyright notice, | |
// this list of conditions and the following disclaimer. | |
// | |
// 2. Redistributions in binary form must reproduce the above copyright |
This file contains 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
(){ | |
autoload -U colors ; [[ ${(t)fg} != association* ]] && colors | |
local ul="%{"$'\e['"$color[underline]m%}" | |
local rs="%{$reset_color%}" | |
local cerr="%{$fg_bold[red]%}" | |
local cuser="%{$fg[green]%}" | |
local cuser_root="%{$fg[green]${bg[red]}%}" | |
local chost="%{$fg[yellow]%}" | |
local cjobs="%{$bold_color%}" | |
local cdirs="%{$fg_bold[green]%}" |
This file contains 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 -eu | |
# | |
# Usage: | |
# aws-instance-sshhostkeys i-deadbeef | tee -a .ssh/known_hosts | |
# FIXME: | |
# Strip trailing CR | |
# Strip trailing comment field | |
# Support Route53 entries automatically |
This file contains 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 zsh -f | |
# | |
# Wrap the execution of a command which is installed via a Python | |
# pyenv/virtualenv so that we can invoke it like a normal command, with | |
# python/env set up correctly for us. Assumes that the command uses a | |
# virtualenv named for the command, and that one common python version | |
# is being used for all such commands. | |
set -e | |
# -u will fail with _OLD_VIRTUAL_PATH unset |
This file contains 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 | |
import binascii | |
with open('foo.hvif', 'wb') as out: | |
out.write(binascii.unhexlify(b''.join(open('foo.hvif.txt', 'rb').read().split()))) |
This file contains 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 -eu | |
prefix='philpennock-pgp' | |
keyid='0x4D1E900E14C1CC04' | |
progname="$(basename -- "$0")" | |
umask 0077 | |
[ -d ~/.gnupg/export ] || mkdir ~/.gnupg/export | |
cd ~/.gnupg/export |