Skip to content

Instantly share code, notes, and snippets.

View suhlig's full-sized avatar
😻
Happy

Steffen Uhlig suhlig

😻
Happy
View GitHub Profile
@suhlig
suhlig / totp-qrencode.sh
Created August 30, 2022 11:10
Generate 2FA auth code from known secret
pbpaste | xargs -I {} qrencode -t UTF8 -o - 'otpauth://totp/github.com/suhlig?secret={}&issuer=GitHub'
@suhlig
suhlig / qrencode.sh
Last active September 10, 2022 09:24
Encode the clipboard content as QR code and show it in Preview
# adapted from https://twitter.com/David3141593/status/1509457643206811652
pbpaste | qrencode -o - | open -fa Preview
# terminal only
pbpaste | qrencode -t UTF8 -o -
@suhlig
suhlig / build-and-launch-dlv.bash
Created June 4, 2022 16:39
Use VS Code to debug a go program that is running externally
# see also https://github.com/go-delve/delve/tree/master/Documentation/api/dap
go build -o plaintweet-darwin \
&& dlv exec --headless --log --api-version 2 --listen localhost:42353 -- ./plaintweet-darwin serve
@suhlig
suhlig / template-introspection.go
Created May 5, 2022 13:29
Golang Template Introspection
{{ printf "%#v" . }}
@suhlig
suhlig / iCatcher-Top-10-2021.sql
Created December 18, 2021 16:14
Create my list of #TopTenPodcasts2021
SELECT
CAST(SUM(ZMEDIADURATION) / 60 / 60 AS INT) AS listened_hours,
ZPODCAST.ZTITLE as podcast,
ZURL as url
FROM
ZPODCAST,
ZPODCASTEPISODE
WHERE
ZPODCASTEPISODE.ZPODCASTFOREPISODE == ZPODCAST.Z_PK
AND
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@suhlig
suhlig / zsh-histdb-queries.sql
Created July 14, 2021 08:31
Useful queries against zsh-histdb
-- start sqlite monitor with _histdb_query
-- most-often used commands; top ones at the bottom
SELECT
commands.argv, count(*) as invocation_count
FROM
history
LEFT JOIN
commands
ON
@suhlig
suhlig / steampipe_hn.sh
Created May 23, 2021 11:23
Yesterdays Top HN as JSON
steampipe query --output json "
select
title, url, 'https://news.ycombinator.com/item?id=' || id as comments_url
from
hackernews_top
where
time > current_date - interval '24 hour'
order by
score desc
limit
@suhlig
suhlig / recrawl-pinboard.js
Created April 9, 2021 13:38
Re-crawl pinboard links
$x("//a[@title='Click to re-crawl this link']").forEach(element => element.click());