Skip to content

Instantly share code, notes, and snippets.

View CatoLynx's full-sized avatar

Cato CatoLynx

View GitHub Profile
@CatoLynx
CatoLynx / wg_aliases.sh
Last active June 30, 2023 14:09
Bash script to append aliases to peer IDs in Wireguard output
#!/bin/bash
# To the extent possible under law, I hereby waive all copyright
# and related or neighboring rights to this program.
# Determine the path of this script, to read the aliases file relative to that
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# Check if the unbuffer command is available.
# It is used to retain colored output from wg show
@CatoLynx
CatoLynx / gist:1bca4d275c99976f9815
Last active August 29, 2015 14:08
Catch only a specific APIError and let others through
def catch_only_rate_limit():
try:
do_some_twitter_stuff()
except tweetpony.APIError as error:
if error.code == 88:
print "Oops, rate limited!"
else:
raise