Skip to content

Instantly share code, notes, and snippets.

View thehowl's full-sized avatar
🧙‍♂️
cooking scrambled eggs on my cpu

Morgan thehowl

🧙‍♂️
cooking scrambled eggs on my cpu
View GitHub Profile
//go:build ignore
package main
import (
"fmt"
"go/doc"
"go/parser"
"go/token"
"io/fs"
$ go test -v -run 'Testdata/1588' .
=== RUN TestTestdata
=== RUN TestTestdata/issue-1588
testscript.go:534: WORK=$WORK
PATH=/usr/lib/go/bin:/home/howl/bin:/home/howl/go/bin:/home/howl/.yarn/bin:/home/howl/.npm-packages/bin:/home/howl/go/bin:/home/howl/.yarn/bin:/home/howl/.npm-packages/bin:/home/howl/.asdf/shims:/home/howl/.local/share/asdf/bin:/home/howl/bin:/home/howl/go/bin:/home/howl/.yarn/bin:/home/howl/.npm-packages/bin:/home/howl/.cargo/bin:/home/howl/.nvm/versions/node/v16.18.0/bin:/home/howl/go/bin:/home/howl/.yarn/bin:/home/howl/.npm-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/howl/py/bin:/home/howl/py/bin
GOTRACEBACK=system
HOME=/no-home
TMPDIR=$WORK/.tmp
devnull=/dev/null
/=/
@thehowl
thehowl / trace.go
Last active January 15, 2024 21:59
a utility function to print compact stacktraces - https://go.dev/play/p/cAyTUqy1p_I
/* Sample output:
prog.go:11 main.main
proc.go:250 runtime.main
asm_amd64.s:1598 runtime.goexit
*/
package main
import (
"fmt"
@thehowl
thehowl / unfollow-all.js
Created February 11, 2022 11:23
Script to unfollow people from last.fm when you have recovered your account after 5 years and in the meantime a followbot had taken over.
Array.from(document.querySelectorAll(".user-list-inner-wrap")).filter(x => x.querySelector(".user-follow") === null).forEach(x => x.querySelector('.follower-btn-following').click())
@thehowl
thehowl / generate-smart-certificate.sh
Last active July 17, 2023 20:41
The following scripts can aid in the creation of JWKs and server certificates for SMART Health Cards.
#!/usr/bin/env bash
# Small script to create a certificate authority to be used for SMART Health Cards.
# The script accepts an argument, which is the name of your organisation (ie. "ACME Ltd")
# The script will generate a data subdirectory in $PWD, the relevant files for
# the implementation of SMART Health Cards are issuer.key8 and chain.
# SUBJECT_ALT_NAME should be adjusted accordingly.
set -e
set -u
set -o pipefail
@thehowl
thehowl / tool
Last active May 7, 2020 16:52
probably the only good build tool
#!/bin/bash
# provides documentation for the sub-commands.
DOCUMENTATION=(
'help [COMMAND]'
"returns help for the specified command, or for all commands if none is specified.
$ ./tool help
$ ./tool help up"
'dev [COMMAND]'
@thehowl
thehowl / go-crosscompile-all
Created December 19, 2018 10:12
uncomplicated crosscompilation of the major 9 platforms in go
#!/usr/bin/bash
# Looking at the source, I see.
# Bear with me. I can barely understand bash, let alone writing it.
# See that something can be done in a much better way? Just Pull Request It (tm)
if [ -z ${1+x} ]; then nproj=${PWD##*/}; else nproj=$1; fi
echo project name $nproj
for GOOS in darwin linux windows; do
for GOARCH in 386 amd64; do
echo "Building $GOOS-$GOARCH"
if [ $GOOS == "windows" ]; then extension=".exe"; else extension=""; fi
@thehowl
thehowl / about.md
Last active March 22, 2018 22:15
Claws piping example

Claws was originally built because I had to scratch my own itch, which is to say I was implementing a WebSocket API for a project of mine, Ripple (not the cryptocurrency!) and there was no good command-line WS client that wasn't completely barebones. So that's really how the project was born.

Here's an example of the piping feature, using the Ripple WS API. It's really only to demonstrate what it can do (I needed something I could build in a reasonable amount of time and that was easily understandable :P). But, with programming, the sky is the limit, so create your own scripts to serve your purpose!

#!/usr/bin/env python3
import requests
import sys
a = set()
def fofo(uri):
resp = requests.get(uri)
if resp.status_code != 200:
#
# Sphinx configuration file sample
#
# WARNING! While this sample file mentions all available options,
# it contains (very) short helper descriptions only. Please refer to
# doc/sphinx.html for details.
#
#############################################################################
## data source definition