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 / 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
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());
@suhlig
suhlig / git-duet-rebase.markdown
Created October 20, 2020 09:08
git-duet rebasing

from git-duet:

Rebasing (resets the committer to the committer of the current pair):

$ git rebase -i --exec 'git duet-commit --amend'
@suhlig
suhlig / events.sql
Created May 17, 2020 21:21
In Grafana, show events stored in InfluxDB
# Insert an event into InfluxDB
use e5573;
INSERT events title="Disabled unattended-upgrades",description="We should see reduced bandwidth usage from here on",tags="apt,debug,bandwidth";
# Configure the annotation in Grafana
# https://grafana.com/docs/grafana/latest/features/datasources/influxdb/#annotations
SELECT title, description from events WHERE $timeFilter ORDER BY time ASC;
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# This is an updated version of https://lebkowski.name/docker-volumes
main() {
remove-exited-containers
remove-unused-images
@suhlig
suhlig / switch-fly-version.markdown
Created July 18, 2019 09:57
Switch fly version

I work with a lot of different Concourse servers that have a variety of versions. fly rejects working with servers that are off to much. Therefore I have fly-3.14.1, fly-4.2.3 etc. on my machine.

But many set-pipeline scripts assume that a single fly command exists and that it magically is of the right version. So I need to switch; preferably per directory or per shell.

Did not work

  • Shell aliases are never exported, so that a set-pipeline script does not know about the alias.
  • I use ZSH, where functions cannot be exported.

Works