Skip to content

Instantly share code, notes, and snippets.

View reacocard's full-sized avatar
🐱

Ayla Ounce reacocard

🐱
View GitHub Profile
@reacocard
reacocard / mirrors.txt
Created May 29, 2019 05:47
Debian mirror benches (from Sunnyvale CA, 2019-03-22, 75mbit cable connection)
# tests:
# timeout 30s curl --output /dev/null ${mirror}pool/main/libr/libreoffice/libreoffice_6.2.2~rc1.orig.tar.xz (use Average Dload)
# cat /etc/apt/mirrorlists/debian | grep https | cut -d/ -f 3 | xargs -P0 -n1 -I DNS zsh -c "ping -q -n -A -c 10 -w 15 DNS | tail -n 1 | cut -d/ -f5 | sed 's/\(.*\)/'DNS': \1/'"
# Dload: 7937k, Ping: 33.033
https://deb.debian.org/debian/
# Dload: 7899k, Ping: 32.239
https://mirrors.namecheap.com/debian/
@reacocard
reacocard / retry.sh
Last active September 18, 2023 15:32
Bash retry function with exponential backoff.
#!/usr/bin/env bash
# This software is freely available under the Apache 2.0 license.
# Full license available here: https://www.apache.org/licenses/LICENSE-2.0.txt
set -o errexit
set -o nounset
set -o pipefail
# Retry a command on a particular exit code, up to a max number of attempts,

Keybase proof

I hereby claim:

  • I am reacocard on github.
  • I am reacocard (https://keybase.io/reacocard) on keybase.
  • I have a public key whose fingerprint is 272A D52A D02D 8DDA 1EBE DD83 4351 A9A7 5F0D 6FEB

To claim this, I am signing this object:

@reacocard
reacocard / gist:1063050
Created July 4, 2011 08:17
python decorator to make functions act statically typed
function = type(lambda x: x)
def __listcheck(typ, arg):
for i,x in enumerate(arg):
if not any((_typecheck(t, x) for t in typ)):
raise TypeError, "List member %s, \"%s\" is not of type %s!"%(i,x,typ)
return True
def __tuplecheck(typ, arg):
if len(typ) != len(arg):