Skip to content

Instantly share code, notes, and snippets.

next-output-file-name () {
base="$1"
for ((i=0; i<20; i++)); do
filename="${base}.${i}"
[[ ! -e "$filename" ]] && print "$filename" && return
done
print "ERROR"
}
append-tee-file-base () {
@slumos
slumos / config.org
Created July 7, 2021 20:33
configure hydra from a table

Hydra

(use-package hydra)
(use-package use-package-hydra)
@slumos
slumos / groups.conf
Created February 2, 2021 19:12
puppet query groups.conf
[Main]
default: match
confdir: $CFGDIR/groups.d
autodir:
[env]
map: puppet query 'nodes[certname] { catalog_environment = "$GROUP" }' | jq -r '.[].certname'
list: puppet query 'environments {}' | jq -r .[].name
[cluster]
@slumos
slumos / kh-reset.sh
Created June 22, 2018 22:00
reset known_hosts entry for a hostname
#! /usr/bin/env zsh
if [[ $# != 1 ]]; then
print Usage: kh-reset hostname
exit 1
fi
# Expand the different hostnames and IP
if [ -x /usr/bin/dscl ]; then
# macOS
@slumos
slumos / fssh.sh
Created September 21, 2017 21:12
21Sep 14:10:47 ~ 0% which fssh
fssh () {
hosts="$1 $(getent hosts $1)"
if [ -x /usr/bin/dscl ]
then
hosts="$hosts $(dscl . read /Hosts/$1 | awk '/^IPAddress/ { print $2 }')"
fi
for h in ${=hosts}
do
ssh-keygen -R $h >&/dev/null
@slumos
slumos / osx-for-hackers.sh
Created May 28, 2017 04:17 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
function l {
if [[ ! -t 0 ]]; then
# stdin is not connected to a tty
pager -
elif [[ $# -eq 1 && -f "$1" ]]; then
# single argument names a file
pager "$1"
else
ls -CFL $*
fi
%{remote_ip} says %{http_code}
%{content_type}
downloaded %{size_download} bytes at %{download_speed} bytes/s
DNS lookup: %{time_namelookup}
TCP connect: %{time_connect}
SSL connect: %{time_appconnect}
Time to FB: %{time_starttransfer}
Total: %{time_total}
#! /usr/bin/env zsh
echo \\a
title=Ding
message="${*:-DONE}"
function is_available {
command -v $* >& /dev/null
}

Keybase proof

I hereby claim:

  • I am slumos on github.
  • I am slumos (https://keybase.io/slumos) on keybase.
  • I have a public key ASBdn-52LO1HzxXYtc6_MTvDuuXYOy6oaj1KOQv5fMBsFAo

To claim this, I am signing this object: