Skip to content

Instantly share code, notes, and snippets.

View ZetaTom's full-sized avatar

Tom ZetaTom

View GitHub Profile
@ZetaTom
ZetaTom / nclogin.sh
Created January 22, 2026 13:08
Script to automate login for Nextcloud Android client via ADB.
#!/bin/bash
# default values for prompts
NC_DEFAULT_SERVER=http://127.0.0.1:8080
NC_DEFAULT_USER=alice
NC_DEFAULT_PASS=password
NC_DEFAULT_ACTION=android.intent.action.VIEW
################################################################################
# fail on non-zero pipeline status
@ZetaTom
ZetaTom / reformat-watch-history.sh
Created November 22, 2024 11:31
Reformat FreeTube watch history for invidious (YouTube JSON).
#!/bin/sh
jq -sc '[.[] | {header: "YouTube", title, titleUrl: ("https://www.youtube.com/watch?v\u003d" + .videoId), subtitles: [{name: .author, url: ("https://www.youtube.com/channel/" + .authorId)}], time: (.timeWatched / 1000 | round | todateiso8601), products: ["YouTube"]}]' freetube-history-*.db > freetube-history.json
@ZetaTom
ZetaTom / fw13-eq-sink.conf
Created March 17, 2024 08:10
Framework 13 PipeWire Speaker EQ (without EasyEffects)
# ### Credits ###
# This config uses the parameters published by user Philonmetal
# on https://community.frame.work/t/speakers-sound-quality.
#
# ### Installation ###
# 1. Download this file
# 2. Install it into ~/.config/pipewire/pipewire.conf.d/
# 3. Restart your machine (or PipeWire itself)
#
# ### Usage ###
@ZetaTom
ZetaTom / cfd.py
Created September 5, 2023 17:26
Cloudflare DynDNS updater script
import http.client
import json
import socket
import sys
from enum import Enum
Method = Enum('Methods', ["INTERNAL", "EXTERNAL", "DNS"])
# Cloudflare API Configuration
config_cf_record_name = "subdomain"
@ZetaTom
ZetaTom / vtt2srt.py
Last active July 19, 2023 15:46
Quick and dirty VTT to SRT converter.
#!/usr/bin/python3
import sys
def main(input_filename: str, output_filename: str):
input_file = open(input_filename, 'r')
output_file = open(output_filename, 'w')
colours = {}
sub_index = 1
@ZetaTom
ZetaTom / ttml2srt.py
Last active July 29, 2023 09:31
Quick and dirty TTML to SRT converter.
#!/usr/bin/python3
import sys
def get_content(line: str):
i = line.find('>')
j = line.rfind('<')
if i < 0 or j < 0:
return ''
return line[i + 1:j]
@ZetaTom
ZetaTom / studnet@.service
Created May 11, 2023 14:27
Systemd service to automatically authenticate with studnet (Studentenwerk Leipzig).
[Unit]
Description=Log on to and authenticate with studnet
After=network.target
Wants=network-online.target
[Service]
Restart=always
RestartSec=2
User=%i
ExecStart=/usr/bin/sshpass -p "<<password>>" ssh -t -t -o ServerAliveInterval=15 -o ServerAliveCountMax=3 <<tenant-id>>@<<auth-server>>
@ZetaTom
ZetaTom / refresh-unbound-filter.sh
Created May 11, 2023 14:24
Download StevenBlacks unified dns backlist, convert to unbound local-zones and restart unbound service.
#!/bin/bash
# Download StevenBlacks unified dns backlist, convert to unbound local-zones and restart unbound service.
src="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
dest="/etc/unbound/unbound.conf.d/filter.conf"
tmp="/tmp/unbound_filter.conf"
prefix="server:"
# handle pipeline errors
set -o pipefail
@ZetaTom
ZetaTom / userContent.css
Created May 4, 2023 14:07
Change discords font to match system font in Firefox.
/* 1. insert into ~/.mozilla/firefox/*.default-release/chrome/userContent.css
2. enable toolkit.legacyUserProfileCustomizations.stylesheets in about:config
3. restart Firefox
*/
@-moz-document url-prefix("https://discord.com/channels") {
body {
--font-primary: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
--font-display: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
--font-headline: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
@ZetaTom
ZetaTom / enable_rdp.sh
Created May 4, 2023 14:02
Enable gnome-remote-desktop (rdp) from cli when using automatic login.
#!/bin/bash
passfile=~/.config/.rdppass
# Unlock gnome-keyring
read -rsp "Password: " pass
export $(echo -n "$pass" | gnome-keyring-daemon --replace --unlock)
systemctl --user restart gnome-remote-desktop.service
# Determine rdp password
if [ -f "$passfile" ]; then