Skip to content

Instantly share code, notes, and snippets.

View afresh1's full-sized avatar

Andrew Hewus Fresh afresh1

View GitHub Profile
@afresh1
afresh1 / tmup.sh
Created May 15, 2013 22:11
I use this in my .bashrc to update my shell environment from tmux
tmup () {
echo -n "Updating to latest tmux environment...";
local IFS=",";
for line in $(tmux showenv -t $(tmux display -p "#S") | tr "\n" ",");
do
if [[ $line == -* ]]; then
unset $(echo $line | cut -c2-);
else
export $line;
@afresh1
afresh1 / post_dmesg_to_nycbug.pl
Last active December 22, 2021 22:14
This script posts an OpenBSD dmesg to the NYC*BUG archive at http://www.nycbug.org/index.cgi?action=dmesgd
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
use feature 'signatures';
no warnings 'experimental::signatures';
use Sys::Hostname;
use HTTP::Tiny;
@afresh1
afresh1 / teetime
Last active December 22, 2021 22:14
A perl implementation of "tee" that prefixes each line to the teed file with a timestamp relative to the start of ths script.
#!/usr/bin/perl
use strict;
use warnings;
use v5.10;
use Time::HiRes qw< gettimeofday tv_interval >;
# Copyright (c) 2020 Andrew Hewus Fresh <andrew@afresh1.com>
#
# Permission to use, copy, modify, and distribute this software for any
@afresh1
afresh1 / tssh.sh
Last active December 22, 2021 22:14
A simple clusterssh clone to ssh into many machines at once in a single tmux session. Use `set synchronize-panes` to send commands to all panes at once.
#!/bin/sh
# tssh -- Andrew Fresh <andrew AT AFresh1.com>
set -e
if [ -z "$*" ]; then
echo "usage: tssh server1 [[[server2] server3] ...]"
exit 2
fi
new=""
@afresh1
afresh1 / fill-chroot.sh
Last active December 22, 2021 22:14
fill-chroot - Add files and their needed libs to a chroot directory
#!/bin/sh
chroot=/var/www # ${PWD}
copy_recurse() {
file=$1
[ -e "${chroot}${file}" ] && return
mkdir -p $( dirname "${chroot}${file}" )
cp -p "$file" "${chroot}${file}"
@afresh1
afresh1 / vmctl-ssh
Last active December 22, 2021 22:10
A helper to look up the IP for and ssh into an OpenBSD vmd vm that uses the standard tap interface in a bridge setup. Lots of setups this won't work for, but the one where vmd provides the IP seems to work OK.
#!/usr/bin/perl
use v5.30;
use warnings;
use OpenBSD::Pledge;
use OpenBSD::Unveil;
# Copyright (c) 2021 Andrew Hewus Fresh <andrew@afresh1.com>
#
# Permission to use, copy, modify, and distribute this software for any
@afresh1
afresh1 / clean-dupes.pl
Last active December 22, 2021 22:08
A perl duplicate file finder based on size and hash. Uses only core perl modules.
#!/usr/bin/env perl
use v5.16;
use warnings;
#
# Copyright (c) 2021 Andrew Hewus Fresh <andrew@afresh1.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
@afresh1
afresh1 / force_rsync.sh
Created August 25, 2021 15:55
A script to use as an SSH ForceCommand that only lets root connect to run rsync in the way FreeNAS/TrueNAS does it.
#!/bin/sh
expect='rsync --server --sender -logDtprze.LsfxC . /'
dir="/${SSH_ORIGINAL_COMMAND#$expect}"
# Try without compression
if [ "$dir" = "/${SSH_ORIGINAL_COMMAND}" ]; then
expect='rsync --server --sender -logDtpre.LsfxC . /'
dir="/${SSH_ORIGINAL_COMMAND#$expect}"
fi
@afresh1
afresh1 / git_prompt.sh
Last active October 13, 2021 11:03
My git branch prompt, colorizes the branch based on status. Might need some work on the colors as yet. Apart from the definition, works in bash or ksh.
function _git_prompt() {
local _branch=`git branch --no-color 2> /dev/null | sed -ne 's/^* //p'`
[[ -z $_branch ]] && return
local _bgcolor
local _color
for s in `git status --porcelain | tr ' ' '.' | cut -c 1-2`; do
if [ -z "$_color" ]; then
case "$s" in

I thought perhaps you might like to hear my somewhat unique perspective, although definitely not saying anything others haven't already said. My perspective comes from my three hats, as a perl hobbyist and CPAN author, the maintainer of /usr/bin/perl in OpenBSD, and as someone who has written perl professionally for just short of ten years (the fifteen before that I wrote more and more perl as a sysadmin).

Overall, I think the plan is excellent and hope it mostly moves forward. There's only one tiny issue that might keep me from coming along for the ride.

tl;dr: if the default, without concious indication of something else, for bin/perl is anything but a "best effort at perl5" I believe I, and many other people will be stuck on perl5 forever and never be able to use v7, or v8, or anything later.

First, I should probably explain what I mean by a "best effort perl5". It is the thing we have gotten from perl on code without "use v5;" specified, likely since perl 5 was first released. Most things work, s