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 | |
set -e -u | |
tempprefix="$(basename "$0")" | |
tempdir="$(mktemp -d -t "${tempprefix}.XXXXXXXXXX")" | |
trap 'rm -rf "$tempdir"' EXIT | |
cd "$tempdir" || exit |
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 | |
# -*- coding: utf-8 -*- | |
# This script is a simple wrapper which prefixes each i3status line with custom | |
# information. It is a python reimplementation of: | |
# http://code.stapelberg.de/git/i3status/tree/contrib/wrapper.pl | |
# | |
# To use it, ensure your ~/.i3status.conf contains this line: | |
# output_format = "i3bar" | |
# in the 'general' section. |
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 | |
notify-send \ | |
--expire-time=700 \ | |
"$(pacmd list-sources | awk 'BEGIN { FPAT = "[^ \t]+|\"[^\"]+\"" } $1 == "*" { find=1 } $1 == "device.description" { if (find) { print substr($NF,2,length($NF)-2); exit; } }')" \ | |
"→ $(amixer set Capture toggle | grep -oP '(?<=\[)o[nf]+(?=\])' | sort -u)" |
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 | |
# PulseAudio configuration to stream video files and microphone audio to | |
# v4l2sink; locally hearing the video files but not the microphone. | |
# Video files -> OBS -> OBS Monitor -> "MediaInterim" \ | |
# |-> Speakers | |
# `-> "FinalStream" | |
# Microphone -> "FinalStream" |
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
# Compare which peers are present at different IXPs: | |
curl -s https://www.peeringdb.com/api/ix/123 | jq .data[0].ixlan_set[].id | xargs -I@ curl -s https://www.peeringdb.com/api/ixlan/@ | jq -j -r '.data[0].net_set[]|(.name,", AS ",.asn, "\n")' | sort > kleyrex.txt | |
# Let's you do things like "show me peers that are present at Locix, but not at Kleyrex" | |
comm -23 locix.txt kleyrex.txt |
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 python2 | |
""" Convert values between RGB hex codes and xterm-256 color codes. | |
Nice long listing of all 256 colors and their codes. Useful for | |
developing console color themes, or even script output schemes. | |
Resources: | |
* http://en.wikipedia.org/wiki/8-bit_color | |
* http://en.wikipedia.org/wiki/ANSI_escape_code |
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 | |
wget https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers | |
awk -F '[ ]' 'BEGIN {nr=-1} NF==1 && $1 == 0+$1 {if ($1 != (nr+1)) {for (i=nr+1; i<$1; i++) {print i}}; nr=$1}' enterprise-numbers |
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 | |
ip_to_hostname () | |
{ | |
if [ -z "$1" ] | |
then | |
printf '%s\n' "unknown" | |
else | |
nc -w 1 "$1" 587 < /dev/null | head -n 1 | awk '{if ($0 == "") {print "none"} else if ($1 == "220" && $0 ~ "SMTP ") {print $2} else {print "unknown"}}' | |
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
#!/usr/bin/env bash | |
## fix-umlauts.sh | |
# Converts umlauts (äöüß) in files to "Code page 437" encoding, so they will | |
# display correctly in PXELINUX boot menus. | |
# Expects one or more file paths as arguments, e.g.: | |
# $ ./fix-umlaut.sh "pxelinux.cfg/menus/main.menu" "pxelinux.cfg/menus/admin.submenu" | |
# The files are overwritten in place (using a temp file). | |
# ------- |
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 python | |
# -*- coding: utf-8 -*- | |
# | |
# This is how I used it: | |
# $ cat ~/.bash_history | bash-history-to-zsh-history >> ~/.zsh_history | |
import sys | |
def main(): |
NewerOlder