This commit is contained in:
ryfrd 2025-08-14 15:16:21 +01:00
parent c4dcb6e38b
commit 531029a18f
129 changed files with 7765 additions and 6938 deletions

View file

@ -1,5 +1,5 @@
---
title: chess.com api and the continuing search for en passant checkmate
title: "The search for en passant checkmates 2: Electric Boogaloo"
date: 2022-11-08
tags:
- chess

View file

@ -1,5 +1,5 @@
---
title: chess.com api and the search for en passant checkmate
title: The search for en passant checkmates
date: 2022-10-26
tags:
- chess

View file

@ -1,5 +1,5 @@
---
title: declarative firefox config with home-manager on nixos
title: Declarative firefox config with home-manager on nixos
date: 2022-10-02
tags:
- nixos

View file

@ -1,5 +1,5 @@
---
title: translating docker to nix?!
title: Translating docker to nix?!
date: 2023-02-28
tags:
- docker

View file

@ -1,5 +1,5 @@
---
title: elite bread dough for lazy boys
title: Bread dough for lazy boys
date: 2023-01-22
tags:
- cooking

View file

@ -1,5 +1,5 @@
---
title: get the thoughts out of your head and into a digital format with this python journal script
title: Get the thoughts out of your head and into a digital format with this python journalling script
date: 2022-12-01
tags:
- python

View file

@ -1,5 +1,5 @@
---
title: so you want to write a neovim plugin with lua
title: So you want to write a neovim plugin with lua
date: 2024-04-06
tags:
- lua

View file

@ -1,5 +1,5 @@
---
title: lowkey emacs setup
title: Lowkey emacs setup bits and bobs
date: 2022-11-18
tags:
- emacs

View file

@ -1,5 +1,5 @@
---
title: making nix-colors talk to neovim
title: Making nix-colors talk to neovim
date: 2023-08-18
tags:
- nix-colors

View file

@ -1,5 +1,5 @@
---
title: multi user qtile fiddling
title: Multi user qtile fiddling
date: 2022-12-20
tags:
- qtile

View file

@ -1,5 +1,5 @@
---
title: theming nirvana
title: Achieve peak rice with nix-colors
date: 2023-03-13
tags:
- nixos

View file

@ -1,5 +1,5 @@
---
title: over-engineered (?) nixos blog deployment setup
title: Over-engineered (?) nixos blog deployment setup
date: 2025-08-11
tags:
- nixos

View file

@ -1,12 +1,12 @@
---
title: podcast setup for broke boys whose trash phone cant hack modern apps
title: Python podcast scripting
date: 2023-01-24
tags:
- python
draft: false
---
I have an old sad android phone with 2GB of ram which nowadays seems to struggle with anything but the most lightweight apps. As a result of this I have been 'podcast-player-hopping' without success for the last couple of months trying to find something which doesn't nuke my phone whenever I use it. In a moment of desperation it occured to me that a creative solution might be required. The gameplan was this:
I have an old sad android phone with 2GB of ram which nowadays seems struggles these days. As a result of this I have been 'podcast-player-hopping' without success for the last couple of months trying to find something which doesn't nuke my phone whenever I use it. In a moment of desperation it occured to me that a creative solution might be required. The gameplan was this:
- write python script to download podcasts
- set up cron job on my server to run script every couple of hours

View file

@ -1,6 +1,6 @@
---
title: rudimentary local scrobbling with bash
date: 2022-09-13
title: Rudimentary local scrobbling with bash
date: 2022-09-13
tags:
- music
- bash

View file

@ -3,7 +3,7 @@ title: setting up a lean mean hugo blogging theme
date: 2022-11-10
tags:
- hugo
draft: false
draft: true
---

View file

@ -1,5 +1,5 @@
---
title: simple nixos config for vps static site
title: Simple nixos config for vps static site
date: 2023-01-29
tags:
- nixos

View file

@ -1,5 +1,5 @@
---
title: tailscale, caddy, and nixos containers - a match made in heaven
title: Tailscale, caddy, and nixos containers
date: 2023-05-16
tags:
- nixos

View file

@ -1,5 +1,5 @@
---
title: teeny tiny bash fetch script
title: Teeny tiny bash fetch script
date: 2022-12-10
tags:
- bash

View file

@ -1,5 +1,5 @@
---
title: upgrade your qtile setup with a cute dropdown terminal
title: Upgrade your qtile setup with a cute dropdown terminal
date: 2022-09-23
tags:
- python

View file

@ -1,5 +1,5 @@
---
title: vanilla javascript theme toggle for simpletons
title: Vanilla javascript theme toggle for simpletons
date: 2023-06-26
tags:
- javascript

View file

@ -1,5 +1,5 @@
---
title: learning about qtile widgets via the medium of cricket
title: Learning about qtile widgets with cricket
date: 2023-04-03
tags:
- qtile

View file

@ -0,0 +1,106 @@
---
title: Handy script for a more zen twitch experience
date: 2025-08-13
tags: bash, script, twitch
draft: false
---
I like to watch twitch streams.
Watching them in the browser at `twitch.tv` is generally not an experience which sparks joy though.
I'm buffering.
I'm declining cookies.
I'm getting spammed with notifications to claim a sick new overwatch skin.
There's a little channel point button twerking for me to click it.
You get the idea; it's a heavy noisy experience.
As a result I set out to devise a solution which does spark joy.
I came up with a script which leans on DIY desktop staples (dunst, tofi, mpv) and the very nice cli utility [streamlink](https://github.com/streamlink/streamlink).
Here it is:
```bash
PLAYER="mpv"
LAUNCHER="tofi"
NOTIFY="dunstify"
# you need an api key, get them here
# https://dev.twitch.tv/docs/api/get-started/
CLIENT_ID="id-here"
CLIENT_SECRET="secret-here-please-sssshh"
# list of streams to check
STREAMS=(
"limmy"
"fl0m"
"northernlion"
"caedrel"
)
# reassure user that something is happening
"${NOTIFY}" "twitch -- checking who's live beep boop be patient"
# get auth token from twitch
ACCESS_TOKEN=$(curl -s -X POST \
"https://id.twitch.tv/oauth2/token" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET" \
-d "grant_type=client_credentials" \
| jq -r '.access_token')
# define empty list
LIVE=()
# loop through streams, check if live and append info to list
for STREAM in "${STREAMS[@]}"; do
RESPONSE=$(curl -s -H "Client-ID: $CLIENT_ID" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
"https://api.twitch.tv/helix/streams?user_login=$STREAM")
LIVE_STATUS=$(echo "$RESPONSE" | jq '.data | length')
if [ "$LIVE_STATUS" -gt 0 ]; then
TITLE=$(echo "$RESPONSE" | jq -r '.data[0].title')
GAME=$(echo "$RESPONSE" | jq -r '.data[0].game_name')
LIVE+=("$STREAM | $GAME | $TITLE")
fi
done
# pipe list items into tofi with new lines at the end
choice="$( printf "%s\n" "${LIVE[@]}" | "${LAUNCHER}")"
if [[ -n "$choice" ]]; then
# get first column from selection aka stream name
meat=$(echo "$choice" | awk '{print $1}')
"${NOTIFY}" "twitch -- launching twitch.tv/$meat"
streamlink twitch.tv/"$meat" 1080p60 --player $"{PLAYER}"
fi
```
### What it does:
- talk to twitch api to get auth token
- loop trough list of streams to check if they're live (using auth token)
- grab some info about streams that are live and append it to a list
- pipe said list into tofi
- capture user's choice
- open choice in mpv using streamlink
### Dependencies
- curl
- jq
- tofi (would work with other launchers dmenu etc.)
- mpv (would work with other media players vlc etc.)
- dunst (would work with other notification daemons mako etc.)
### Positive :)
- no chat (you don't have to read the degenerates spamming LUL)
- you can customise the script to use your favourite desktop tools
- can rewind!
### Negative :(
- no chat (you might want to spam LUL)
- takes a second to talk to the internet so things don't launch immediately
- have to faff with getting api key - [how to get one btw](https://dev.twitch.tv/docs/api/get-started/)