Skip to content

Instantly share code, notes, and snippets.

View GwynethLlewelyn's full-sized avatar
👩
Learning Go

Gwyneth Llewelyn GwynethLlewelyn

👩
Learning Go
View GitHub Profile
@GwynethLlewelyn
GwynethLlewelyn / gist:acfab579afddf1d853be6802a22894d1
Created March 27, 2026 09:54
Retrieve list of AS numbers via whois from Nginx web logs
This assumes [`ugrep`](https://github.com/Genivia/ugrep) is installed. `ugrep` may not be the absolutely fastest `grep` replacement out there, but it has a substantially faster regular expression engine (invented by Genivia) than most alternatives which usually rely upon Boost (which *is* fast already!).
It also assumes that `whois` is installed and listed in `$PATH`. Adapt as appropriate.
The final `sort | uniq` may be replaced with `sort --unique` (if that option is available) and should improve things a little.
```bash
LOGFILE=/var/path/something
ug -e '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' -P --format="%1%~" $LOGFILE | uniq | while read -r line; do whois -H $line | ug -e '(AS\d{1,6})' -P --format="%1%~"; done | sort | uniq
@GwynethLlewelyn
GwynethLlewelyn / mermaid-test.md
Last active September 21, 2025 11:43
Testing Mermaid rendering in GitHub

Explaining rolling window

Basic Flowchart

flowchart TD
    A[Request new task] --> B{Check last 3 task times}
    B -->|All > 72h| C[Eligible]
    B -->|Some < 72h| D[Wait until oldest is >72h]

    C --> E{Check 15-day average}
@GwynethLlewelyn
GwynethLlewelyn / acronyms.vera
Created August 28, 2025 12:46
VERA Acronyms Database for `wtf`
100VG 100 Voice Grade [technology]
10GE 10 GigaBIT Ethernet (ethernet, BIT)
1D2B 1 D-channel 2 B-channels (BRI, ISDN)
2B1D 2 B-channels 1 D-channel (BRI, ISDN)
2S2D Double Sided - Double Density (FDD)
3DC 3D Consortium (org., Sanyo, Sharp, Sony, ...)
3DDDI 3D Device Dependent Interface (MS), "3D DDI"
3DRAM 3 Dimensional Random Access Memory (RAM)
3GIO Third Generation Input/Output (PCIe)
3GIP 3rd Generation . Internet Protocol (org., IP, GPRS, WLAN, mobile-systems), "3G.IP"

An attempt to get all command line configurations working to manually compile Homebrew's Node.js for macOS Big Sur

  ./configure --without-npm --with-intl=system-icu --shared-libuv --shared-nghttp2 --shared-openssl --shared-zlib --shared-brotli --shared-cares --prefix=/usr/local/Cellar/node/23.3.0 --use-prefix-to-find-headers --openssl-use-def-ca-store --enable-lto

Notes

  1. Use default XCode compiler & linker (reset appropriate variables!)
@GwynethLlewelyn
GwynethLlewelyn / extract-uuid.sh
Last active September 17, 2025 07:32
Shell script that will grab all Second Life textures necessary for a specific LLSD XML backup
#!/bin/sh
# Grab all possible textures from LL's own CDN, referenced by UUID from LLSD backups.
# Usage: Go to where your LLSD XML files are stored; run script. Wait a few seconds. Done!
# (cc) 2024–2025 by Gwyneth Llewelyn. Some rights reserved.
# Distributed under the MIT license: https://gwyneth-llewelyn.mit-license.org
# Second Life® is a registered trademark of Linden Lab. No copyright infringement is intended.
#
# `ug` below is `ugrep`, a `grep` replacement, which you can get from here: <https://ugrep.com/>
# All others should be standard on any Un*x system.
# `curl` is usually available on all systems as well, but, if not, you can grab it from <https://curl.se/>
@GwynethLlewelyn
GwynethLlewelyn / convert.sh
Last active July 21, 2024 16:26
Batch conversion using ImageMagick
for file in *.png ; do
magick "$file" -define webp:lossless=true -define webp:auto-filter=true -define webp:filter-strength=50 -define webp:image-hint=picture -define webp:method=6 -define webp:thread-level=1 "${file%.*}.webp" ;
done
@GwynethLlewelyn
GwynethLlewelyn / imagemagick-convert-multiple-resolutions.md
Last active April 7, 2024 21:15
ImageMagick Simultaneously Convert To Multiple Resolutions
convert gw-original-1400.png -write mpr:img +delete \( mpr:img -resize 1280x +write gw-1280.png \) \( mpr:img -resize 1024x +write gw-1024.png \) \( mpr:img -resize 512x +write gw-512.png \) \( mpr:img -resize 500x +write gw-500.png \) \( mpr:img -resize 300x +write gw-300.png \) \( mpr:img -resize 256x +write gw-256.png \) \( mpr:img -resize 160x +write gw-160.png \) \( mpr:img -resize 128x +write gw-128.png \) \( mpr:img -resize 100x +write gw-100.png \) \( mpr:img -resize 90x +write gw-90.png \) \( mpr:img -resize 80x +write gw-80.png \) \( mpr:img -resize 64x +write gw-64.png \) \( mpr:img -resize 50x +write gw-50.png \) \( mpr:img -resize 40x +write gw-40.png \) \( mpr:img -resize 32x +write gw-32.png \) \( mpr:img -resize 16x +write gw-16.png \) null:
h
@GwynethLlewelyn
GwynethLlewelyn / generate-dane-tlsa-records.sh
Last active November 14, 2023 09:45
Viktor Dukhovni's shell script to generate all possible TLSA records for DANE from the full certificate chain
#! /usr/bin/env bash
# Bash needed for PIPESTATUS array
# Author: Viktor Dukhovni <openssl-users@dukhovni.org> (@ietf-dane)
# Date: 28 December 2015
# From https://community.letsencrypt.org/t/making-a-dane-tlsa-to-work-with-le/2129/8
# See also https://community.letsencrypt.org/t/please-avoid-3-0-1-and-3-0-2-dane-tlsa-records-with-le-certificates/7022
extract() {
case "$4" in
0) openssl x509 -in "$1" -outform DER;;
@GwynethLlewelyn
GwynethLlewelyn / convert-from-Latin-1-to-UTF-8.md
Created November 2, 2023 13:20
One-liner shell script to convert every file in a large directory tree from ISO-Latin-1 to UTF-8

Convert files from ISO-8859-1 (Latin-1) to UTF-8, recursively

This requires recode to be installed (brew install recode or apt install recode).

The example shows HTML files only. Adjust as required.

Process:

  1. (Recursively) find all files that end with *.htm or *.html.
  2. For each match, check its file type using file.