Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am westh on github.
  • I am westh (https://keybase.io/westh) on keybase.
  • I have a public key ASBDkiKZ-omaL9-6sgT--lQPOfUpDd_kOdeybwrJwkX0gAo

To claim this, I am signing this object:

@westh
westh / pre-commit
Last active August 18, 2020 09:22
Just a little non-husky pre-commit hook that checks non-ascii file names and runs eslint, put it into .git/hooks if you want to use it ✌️
#!/bin/sh
# heavily inspired by @broofa's script and the default pre-commit sample
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
against=$(git hash-object -t tree /dev/null)
fi
@westh
westh / dtjek
Last active February 6, 2024 06:45
🥞 a small distributed DNS checker – much like dnschecker.org but in your terminal, you could put it in /usr/local/bin or somewhere for easy access
#!/bin/bash
servers=(
"Cloudflare:1.1.1.1"
"Google:8.8.8.8"
"Quad9:9.9.9.9"
"Verisign:64.6.65.6"
)
if [[ $# -eq 0 ]] ; then
@westh
westh / hosted-grafana-with-country-code.sh
Last active April 23, 2023 07:45
Enrich Cloud/Hosted Grafana IPs with country codes
#!/usr/bin/env bash
ips=$(curl -s https://grafana.com/api/hosted-metrics/source-ips.txt)
declare -A country_code_to_ip_map
for ip in $ips; do
country=$(curl -s https://ipinfo.io/$ip/country)
country_code_to_ip_map[$country]="${country_code_to_ip_map[$country]} \"$ip\""
done