Skip to content

Instantly share code, notes, and snippets.

View jtagcat's full-sized avatar
🌻

jtagcat

🌻
View GitHub Profile
@jtagcat
jtagcat / badHash.j2
Last active January 10, 2024 20:54
Jinja Stable UUID with home-brewn hash
{%- macro xor(a, b) %} {#- Macros can only return text #}
{%- if (a and not b) or (not a and b) -%}
1
{%- else -%}
0
{%- endif %}
{%- endmacro -%}
{%- macro bitsToHex(bools) %}
{%- for hex in (bools | batch(4)) %}
@jtagcat
jtagcat / excluded_zfs_to_ncdu.sh
Created June 28, 2022 11:18
Add excluded size from zfs to ncdu
#!/bin/bash
RDIR="tank/foo"
ncdu_dir=.
dsize_bar="$("$ZFS" list -Hp -o usedds "$RDIR/bar")"
ncdu -0o- "/$RDIR" --exclude=bar \
| sed 's/{"name":"bar","dev":0,"ino":0,"excluded":"pattern"}'\
'/{"name":"bar","dev":0,"ino":0,"excluded":"pattern","dsize":'"$dsize_bar"'}/' \
| gzip > "$ncdu_dir/$(date -uI).ncdu.gz"
@jtagcat
jtagcat / staticPodDirty.go
Created June 18, 2022 20:19
Quick and dirty golang for generating a static podcast out of files.
package main
import (
"encoding/csv"
"fmt"
"log"
"os"
"time"
"github.com/eduncan911/podcast"
@jtagcat
jtagcat / comments_on_multiline.sh
Last active March 9, 2022 16:26
Comments on shell multi-line commands, useful in Dockerfile, among other places.
iam command `# comment` \
argument `# comment` \
heeee # comment
@jtagcat
jtagcat / Dockerfile
Last active April 26, 2022 09:20
[NON-FUNCTIONAL] Get golang version from go module
# see https://github.com/jtagcat/dotfiles/blob/main/scripts/template/gobuild.Dockerfile
# stuck on https://github.com/moby/moby/issues/29110
FROM alpine
COPY getGoModVersion.sh .
COPY go.mod .
ENVCMD gover ./dockerGoMod.sh | sed -n '1 p'
FROM golang:$ver AS builder
@jtagcat
jtagcat / github_white_favicon.user.js
Last active June 2, 2023 23:05 — forked from tobbez/github_white_favicon.user.js
[UserScript] GitHub: White favicon
// ==UserScript==
// @name GitHub: White favicon
// @version 1.10.0
// @author tobbez
// @match https://git.521000.bestmunity/*
// @match https://*.github.com/*
// @match https://github.com/*
// @match https://support.github.com/*
// @match https://github.blog/*
// @match https://opensource.guide/*
@jtagcat
jtagcat / sõnaus.csv
Last active December 21, 2021 15:36
https://nova.vabamu.ee/sonastik in CSV, seperator=`,`, header=`true`, quoteall=`true`, escapechar=`\`
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 5.
"sõna","seletus","Kategooria"
"aager","distantsõpe","Digisõna"
"aapoks","digiboks","Digisõna"
"aasak","panoraamfoto","Digisõna"
"aatem","pangaautomaat, sõnast \"ATM\"","Digisõna"
"abroll","tolmuimeja","Digisõna"
"adima","photoshoppima","Digisõna"
"aedud","häkaton","Digisõna"
"aegur","kindla aja möödumisest märku andev seade ehk taimer","Digisõna"
"aelas","digiallkiri","Digisõna"