.
This commit is contained in:
parent
c4dcb6e38b
commit
531029a18f
129 changed files with 7765 additions and 6938 deletions
2
archetypes/default.md
Normal file
2
archetypes/default.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
+++
|
||||
+++
|
||||
14
config.toml
14
config.toml
|
|
@ -1,6 +1,6 @@
|
|||
baseURL = "https://nonsense.dymc.win"
|
||||
title = "James' Blog :-)"
|
||||
theme = "etch"
|
||||
title = "James' Blog"
|
||||
# theme = "etch"
|
||||
languageCode = "en-GB"
|
||||
enableInlineShortcodes = true
|
||||
pygmentsCodeFences = true
|
||||
|
|
@ -17,6 +17,12 @@ pygmentsUseClasses = true
|
|||
title = "--help"
|
||||
url = "/info/"
|
||||
weight = 20
|
||||
# [[menu.main]]
|
||||
# identifier = "search"
|
||||
# name = "search"
|
||||
# title = "search"
|
||||
# url = "/search/"
|
||||
# weight = 20
|
||||
|
||||
[permalinks]
|
||||
posts = "/:title/"
|
||||
|
|
@ -24,3 +30,7 @@ pygmentsUseClasses = true
|
|||
[markup.goldmark.renderer]
|
||||
# Allows HTML in Markdown
|
||||
unsafe = true
|
||||
|
||||
# allows creation of index.json for search
|
||||
[outputs]
|
||||
home = ["HTML", "JSON"]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: translating docker to nix?!
|
||||
title: Translating docker to nix?!
|
||||
date: 2023-02-28
|
||||
tags:
|
||||
- docker
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: elite bread dough for lazy boys
|
||||
title: Bread dough for lazy boys
|
||||
date: 2023-01-22
|
||||
tags:
|
||||
- cooking
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: lowkey emacs setup
|
||||
title: Lowkey emacs setup bits and bobs
|
||||
date: 2022-11-18
|
||||
tags:
|
||||
- emacs
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: multi user qtile fiddling
|
||||
title: Multi user qtile fiddling
|
||||
date: 2022-12-20
|
||||
tags:
|
||||
- qtile
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: theming nirvana
|
||||
title: Achieve peak rice with nix-colors
|
||||
date: 2023-03-13
|
||||
tags:
|
||||
- nixos
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: over-engineered (?) nixos blog deployment setup
|
||||
title: Over-engineered (?) nixos blog deployment setup
|
||||
date: 2025-08-11
|
||||
tags:
|
||||
- nixos
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ title: setting up a lean mean hugo blogging theme
|
|||
date: 2022-11-10
|
||||
tags:
|
||||
- hugo
|
||||
draft: false
|
||||
draft: true
|
||||
---
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: teeny tiny bash fetch script
|
||||
title: Teeny tiny bash fetch script
|
||||
date: 2022-12-10
|
||||
tags:
|
||||
- bash
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: vanilla javascript theme toggle for simpletons
|
||||
title: Vanilla javascript theme toggle for simpletons
|
||||
date: 2023-06-26
|
||||
tags:
|
||||
- javascript
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
106
content/posts/zen-twitch-viewing-script.md
Normal file
106
content/posts/zen-twitch-viewing-script.md
Normal 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/)
|
||||
19
i18n/en.toml
Normal file
19
i18n/en.toml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Learn how to use Date format (date, created, updated)
|
||||
# -> https://gohugo.io/functions/dateformat/
|
||||
|
||||
[posts]
|
||||
|
||||
[posts.title]
|
||||
other = "Posts"
|
||||
|
||||
[posts.date]
|
||||
other = "Jan 2, 2006"
|
||||
|
||||
|
||||
[post]
|
||||
|
||||
[post.created]
|
||||
other = "January 2, 2006"
|
||||
|
||||
[post.updated]
|
||||
other = "Updated January 2, 2006"
|
||||
1
layouts/404.html
Normal file
1
layouts/404.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<h1>uhoh 404 :/</h1>
|
||||
9
layouts/_default/baseof.html
Normal file
9
layouts/_default/baseof.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<html lang="{{ .Site.Language.Lang }}">
|
||||
{{- partial "head.html" . -}}
|
||||
<body>
|
||||
{{- partial "header.html" . -}}
|
||||
<main id="content">{{ block "main" . }}{{ end }}</main>
|
||||
{{ partial "footer.html" . }}
|
||||
</body>
|
||||
</html>
|
||||
9
layouts/_default/index.json
Normal file
9
layouts/_default/index.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{{- $.Scratch.Add "index" slice -}}
|
||||
{{- range .Site.RegularPages -}}
|
||||
{{- $.Scratch.Add "index" (dict
|
||||
"title" .Title
|
||||
"summary" .Summary
|
||||
"url" .Permalink
|
||||
"content" .Plain) -}}
|
||||
{{- end -}}
|
||||
{{- $.Scratch.Get "index" | jsonify -}}
|
||||
4
layouts/_default/list.html
Normal file
4
layouts/_default/list.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{{ define "main" }} {{ range where site.RegularPages "Type" "in"
|
||||
site.Params.mainSections }}
|
||||
<a href="{{ .RelPermalink}}">{{ .Title }}</a>
|
||||
{{ end }} {{ end }}
|
||||
41
layouts/_default/rss.xml
Normal file
41
layouts/_default/rss.xml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- if or $.IsHome $.IsSection -}}
|
||||
{{- $pages = $pctx.RegularPages -}}
|
||||
{{- else -}}
|
||||
{{- $pages = $pctx.Pages -}}
|
||||
{{- end -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{ with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{ range where .Site.Pages "Kind" "page" }}
|
||||
{{ if or (eq .Section "posts") (eq .Section "post") }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Content | html }}</description>
|
||||
</item>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
||||
15
layouts/_default/single.html
Normal file
15
layouts/_default/single.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{{ define "main" }}
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h3>{{ .Title }}</h3>
|
||||
<div>
|
||||
{{- if isset .Params "date" -}} {{ if eq .Lastmod .Date }}
|
||||
<time>{{ .Date | time.Format (i18n "post.created") }}</time>
|
||||
{{ else }}
|
||||
<time>{{ .Lastmod | time.Format (i18n "post.updated") }}</time>
|
||||
{{ end }} {{- end -}}
|
||||
</div>
|
||||
</header>
|
||||
{{- .Content -}}
|
||||
</article>
|
||||
{{ end }}
|
||||
3
layouts/index.html
Normal file
3
layouts/index.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{{ define "main" }}
|
||||
{{ partial "results.html" . }}
|
||||
{{ end }}
|
||||
10
layouts/partials/footer.html
Normal file
10
layouts/partials/footer.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!-- <hr /> -->
|
||||
<footer id="footer">
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
<!-- search javascript -->
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
16
layouts/partials/head.html
Normal file
16
layouts/partials/head.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
{{ with .Site.Params.description -}}
|
||||
<meta name="description" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ printf `<link rel="shortcut icon" href="%s">` ("favicon.ico" | absURL) | safeHTML }}
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
<title>{{ .Title }}</title>
|
||||
</head>
|
||||
19
layouts/partials/header.html
Normal file
19
layouts/partials/header.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<header id="banner">
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
<!-- home -->
|
||||
<a href="{{ .Site.BaseURL }}" class="home">🏠</a>
|
||||
<!-- menu items -->
|
||||
{{ range .Site.Menus.main.ByWeight -}} {{ .Pre }}<a
|
||||
href="{{ .URL }}"
|
||||
title="{{ .Title }}"
|
||||
>{{- .Name -}}</a
|
||||
>{{ .Post }} {{- end }}
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
{{ partial "search.html" . }}
|
||||
<!-- theme toggle -->
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
5
layouts/partials/results.html
Normal file
5
layouts/partials/results.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<ul id="results">
|
||||
{{ range where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
1
layouts/partials/search.html
Normal file
1
layouts/partials/search.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<input type="text" id="search" placeholder="🔎 leaf through the archive"/>
|
||||
|
|
@ -1,2 +1 @@
|
|||
uhoh
|
||||
404
|
||||
<script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script><h1>uhoh 404 :/</h1>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/theming-nirvana/" />
|
||||
<title>theming nirvana</title>
|
||||
<link rel="canonical" href="http://localhost:1313/achieve-peak-rice-with-nix-colors/" />
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>theming nirvana</h1>
|
||||
<div>
|
||||
<time>March 13, 2023</time>
|
||||
</div>
|
||||
</header><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: ‘oh this is cool I can specify which desktop environment to use in my configuration.nix’. Next thing you know you’ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<header id="post-header">
|
||||
<h3>Achieve peak rice with nix-colors</h3>
|
||||
<div>
|
||||
<time>March 13, 2023</time>
|
||||
</div>
|
||||
</header><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: ‘oh this is cool I can specify which desktop environment to use in my configuration.nix’. Next thing you know you’ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
<p>This will be a quick rundown of how I’ve got things set up; this is basically just a rehash of <a href="https://sr.ht/~misterio/nix-colors/#setup">this</a>.</p>
|
||||
|
|
@ -116,9 +123,18 @@
|
|||
</span></span><span class="line"><span class="cl"><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>That’s it for today. Thank you to the <a href="https://github.com/Misterio77">hero</a> that made this.</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
|
||||
<link rel="canonical" href="http://localhost:1313/adventures-in-running-headscale-on-nixos/" />
|
||||
|
||||
<a rel="me" href="https://exuberant.men/@james"></a>
|
||||
<title>adventures in running headscale on nixos</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="http://localhost:1313/">wretched.place</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="info">info</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>adventures in running headscale on nixos</h1>
|
||||
<div>
|
||||
<time>June 25, 2024</time>
|
||||
</div>
|
||||
</header></article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<small>made with <a href="https://gohugo.io">hugo</a> and <a href="https://github.com/LukasJoswiak/etch">etch</a> :)</small>
|
||||
<br>
|
||||
<small><a href="/index.xml">rss</a></small>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/" />
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link rel="canonical" href="http://localhost:1313/bread-dough-for-lazy-boys/" />
|
||||
<title>Bread dough for lazy boys</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>elite bread dough for lazy boys</h1>
|
||||
<div>
|
||||
<time>January 22, 2023</time>
|
||||
</div>
|
||||
</header><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<header id="post-header">
|
||||
<h3>Bread dough for lazy boys</h3>
|
||||
<div>
|
||||
<time>January 22, 2023</time>
|
||||
</div>
|
||||
</header><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don’t have it, it’s not the end of the world)</li>
|
||||
<li>water</li>
|
||||
|
|
@ -63,9 +70,18 @@
|
|||
<li><a href="https://www.youtube.com/watch?v=o4ABOKdHEUs">Ragusea pizza video</a></li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/categories/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/categories/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/categories/" />
|
||||
<link rel="canonical" href="http://localhost:1313/categories/" />
|
||||
<title>Categories</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Categories</h3>
|
||||
<ul id="posts">
|
||||
</ul>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,132 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Categories on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/categories/</link>
|
||||
<description>Recent content in Categories on James' Blog :-)</description>
|
||||
<title>Categories on James' Blog</title>
|
||||
<link>http://localhost:1313/categories/</link>
|
||||
<description>Recent content in Categories on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/categories/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/categories/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -106,11 +211,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -183,11 +288,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -237,11 +342,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -324,11 +429,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -393,11 +498,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -505,11 +610,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -604,11 +709,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -658,11 +763,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -718,12 +823,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -810,11 +915,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -856,11 +961,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -936,11 +1041,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1009,18 +1114,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1080,11 +1185,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1157,104 +1262,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1277,7 +1296,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1305,11 +1324,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1344,18 +1363,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1417,11 +1436,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1438,7 +1457,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1454,7 +1473,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1469,11 +1488,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
9
public/css/dark.css
Normal file
9
public/css/dark.css
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* import common css */
|
||||
@import url("main.css");
|
||||
@import url("syntax.css");
|
||||
|
||||
/* define colors */
|
||||
:root {
|
||||
--bg: black;
|
||||
--fg: white;
|
||||
}
|
||||
9
public/css/light.css
Normal file
9
public/css/light.css
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* import common css */
|
||||
@import url("main.css");
|
||||
@import url("syntax.css");
|
||||
|
||||
/* define colors */
|
||||
:root {
|
||||
--bg: white;
|
||||
--fg: black;
|
||||
}
|
||||
95
public/css/main.css
Normal file
95
public/css/main.css
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/* ===== Base Reset ===== */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
line-height: 1.6;
|
||||
background-color: var(--bg);
|
||||
color: var(--fg);
|
||||
padding: 0 1rem;
|
||||
/* layout */
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* ===== Typography ===== */
|
||||
h1, h2, h3, h4 {
|
||||
line-height: 1.3;
|
||||
font-weight: 600;
|
||||
margin: 1.5rem 0 0.75rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 1.3rem;
|
||||
}
|
||||
|
||||
/* ===== Images ===== */
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/* ===== Navigation ===== */
|
||||
nav {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
nav a {
|
||||
margin: 0.5rem;
|
||||
}
|
||||
|
||||
.home {
|
||||
font-size: 24px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toggle-button {
|
||||
font-size: 24px;
|
||||
border: none;
|
||||
background-color: var(--bg);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toggle-button:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
/* .search-container { */
|
||||
/* text-align: center; */
|
||||
/* } */
|
||||
|
||||
#search {
|
||||
width: 100%;
|
||||
background-color: var(--bg);
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
/* #results li { */
|
||||
/* list-style: none; */
|
||||
/* padding: 20px; */
|
||||
/* font-size: 1.2rem; */
|
||||
/* } */
|
||||
|
||||
footer {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ===== Responsive ===== */
|
||||
@media (min-width: 768px) {
|
||||
body {
|
||||
padding: 0 2rem;
|
||||
}
|
||||
nav {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
1
public/css/style.min.css
vendored
1
public/css/style.min.css
vendored
File diff suppressed because one or more lines are too long
59
public/css/syntax.css
Normal file
59
public/css/syntax.css
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* Background */ .chroma { color: #f8f8f2; background-color: #272822 }
|
||||
/* Error */ .chroma .err { color: #960050; background-color: #1e0010 }
|
||||
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
|
||||
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
|
||||
/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
|
||||
/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||
/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||
/* Keyword */ .chroma .k { color: #66d9ef }
|
||||
/* KeywordConstant */ .chroma .kc { color: #66d9ef }
|
||||
/* KeywordDeclaration */ .chroma .kd { color: #66d9ef }
|
||||
/* KeywordNamespace */ .chroma .kn { color: #f92672 }
|
||||
/* KeywordPseudo */ .chroma .kp { color: #66d9ef }
|
||||
/* KeywordReserved */ .chroma .kr { color: #66d9ef }
|
||||
/* KeywordType */ .chroma .kt { color: #66d9ef }
|
||||
/* NameAttribute */ .chroma .na { color: #a6e22e }
|
||||
/* NameClass */ .chroma .nc { color: #a6e22e }
|
||||
/* NameConstant */ .chroma .no { color: #66d9ef }
|
||||
/* NameDecorator */ .chroma .nd { color: #a6e22e }
|
||||
/* NameException */ .chroma .ne { color: #a6e22e }
|
||||
/* NameFunction */ .chroma .nf { color: #a6e22e }
|
||||
/* NameOther */ .chroma .nx { color: #a6e22e }
|
||||
/* NameTag */ .chroma .nt { color: #f92672 }
|
||||
/* Literal */ .chroma .l { color: #ae81ff }
|
||||
/* LiteralDate */ .chroma .ld { color: #e6db74 }
|
||||
/* LiteralString */ .chroma .s { color: #e6db74 }
|
||||
/* LiteralStringAffix */ .chroma .sa { color: #e6db74 }
|
||||
/* LiteralStringBacktick */ .chroma .sb { color: #e6db74 }
|
||||
/* LiteralStringChar */ .chroma .sc { color: #e6db74 }
|
||||
/* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 }
|
||||
/* LiteralStringDoc */ .chroma .sd { color: #e6db74 }
|
||||
/* LiteralStringDouble */ .chroma .s2 { color: #e6db74 }
|
||||
/* LiteralStringEscape */ .chroma .se { color: #ae81ff }
|
||||
/* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 }
|
||||
/* LiteralStringInterpol */ .chroma .si { color: #e6db74 }
|
||||
/* LiteralStringOther */ .chroma .sx { color: #e6db74 }
|
||||
/* LiteralStringRegex */ .chroma .sr { color: #e6db74 }
|
||||
/* LiteralStringSingle */ .chroma .s1 { color: #e6db74 }
|
||||
/* LiteralStringSymbol */ .chroma .ss { color: #e6db74 }
|
||||
/* LiteralNumber */ .chroma .m { color: #ae81ff }
|
||||
/* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
|
||||
/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
|
||||
/* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
|
||||
/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
|
||||
/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
|
||||
/* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
|
||||
/* Operator */ .chroma .o { color: #f92672 }
|
||||
/* OperatorWord */ .chroma .ow { color: #f92672 }
|
||||
/* Comment */ .chroma .c { color: #75715e }
|
||||
/* CommentHashbang */ .chroma .ch { color: #75715e }
|
||||
/* CommentMultiline */ .chroma .cm { color: #75715e }
|
||||
/* CommentSingle */ .chroma .c1 { color: #75715e }
|
||||
/* CommentSpecial */ .chroma .cs { color: #75715e }
|
||||
/* CommentPreproc */ .chroma .cp { color: #75715e }
|
||||
/* CommentPreprocFile */ .chroma .cpf { color: #75715e }
|
||||
/* GenericDeleted */ .chroma .gd { color: #f92672 }
|
||||
/* GenericEmph */ .chroma .ge { font-style: italic }
|
||||
/* GenericInserted */ .chroma .gi { color: #a6e22e }
|
||||
/* GenericStrong */ .chroma .gs { font-weight: bold }
|
||||
/* GenericSubheading */ .chroma .gu { color: #75715e }
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/" />
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link rel="canonical" href="http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/" />
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>declarative firefox config with home-manager on nixos</h1>
|
||||
<div>
|
||||
<time>October 2, 2022</time>
|
||||
</div>
|
||||
</header><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber’s templates to be very helpful.</p>
|
||||
<header id="post-header">
|
||||
<h3>Declarative firefox config with home-manager on nixos</h3>
|
||||
<div>
|
||||
<time>October 2, 2022</time>
|
||||
</div>
|
||||
</header><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber’s templates to be very helpful.</p>
|
||||
<p>First of all you’ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
<p>This will require having the NUR (nix user repo) enabled. But once you do, you can configure any extension you want to be auto installed with something like this:</p>
|
||||
|
|
@ -83,9 +90,18 @@
|
|||
</span></span><span class="line"><span class="cl"><span class="p">};</span>
|
||||
</span></span></code></pre></div><p>Of course I am sure there are many more exciting things that could be done here but this is as far as I have got. For all avilable options you can check out <a href="https://nix-community.github.io/home-manager/options.html">this</a> or alternatively run a <code>man home-configuration.nix</code>. Hope this has been helpful :)</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/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 journal script</title>
|
||||
<link rel="canonical" href="http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/" />
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>get the thoughts out of your head and into a digital format with this python journal script</h1>
|
||||
<div>
|
||||
<time>December 1, 2022</time>
|
||||
</div>
|
||||
</header><p>Since getting going with emacs I’ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I’m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<header id="post-header">
|
||||
<h3>Get the thoughts out of your head and into a digital format with this python journalling script</h3>
|
||||
<div>
|
||||
<time>December 1, 2022</time>
|
||||
</div>
|
||||
</header><p>Since getting going with emacs I’ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I’m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal’s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT’S THE TIME?</h3>
|
||||
<p>First things first, I wrote this little function that would give you a formatted version of your local time. This will be important as a lot of this comes down to dates and times really. It uses python’s time module:</p>
|
||||
|
|
@ -81,9 +88,18 @@
|
|||
</span></span><span class="line"><span class="cl"><span class="n">main</span><span class="p">()</span>
|
||||
</span></span></code></pre></div><p>As simple as it is, it works reasonalby well as it stands. I would though like to add the ability to customise the file format you want to use so you could have org, plain text, markdown, or whatever. I’ve got the script set to just run with a keybinding at the moment so it fulfils the immediacy I was enjoying with org-journal. You can find the script <a href="https://gitlab.com/robbygozzarder/py">here</a> atm. BYEBYE xxx</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
147
public/handy-script-for-a-more-zen-twitch-experience/index.html
Normal file
147
public/handy-script-for-a-more-zen-twitch-experience/index.html
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/" />
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
<input type="text" id="search" placeholder="🔎 leaf through the archive"/>
|
||||
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h3>Handy script for a more zen twitch experience</h3>
|
||||
<div>
|
||||
<time>August 13, 2025</time>
|
||||
</div>
|
||||
</header><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> 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.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">"mpv"</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">"tofi"</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">"dunstify"</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">"id-here"</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">"secret-here-please-sssshh"</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">"limmy"</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">"fl0m"</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">"northernlion"</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">"caedrel"</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">"</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">"</span> <span class="s2">"twitch -- checking who's live beep boop be patient"</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">"https://id.twitch.tv/oauth2/token"</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">"client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">"</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">"client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">"</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">"grant_type=client_credentials"</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">'.access_token'</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">"</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">"</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">"Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">"</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">"Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">"</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">"https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">"</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$RESPONSE</span><span class="s2">"</span> <span class="p">|</span> jq <span class="s1">'.data | length'</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$LIVE_STATUS</span><span class="s2">"</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$RESPONSE</span><span class="s2">"</span> <span class="p">|</span> jq -r <span class="s1">'.data[0].title'</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$RESPONSE</span><span class="s2">"</span> <span class="p">|</span> jq -r <span class="s1">'.data[0].game_name'</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">"</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">"</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">"</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">"%s\n"</span> <span class="s2">"</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">"</span> <span class="p">|</span> <span class="s2">"</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">"</span><span class="k">)</span><span class="s2">"</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">"</span><span class="nv">$choice</span><span class="s2">"</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$choice</span><span class="s2">"</span> <span class="p">|</span> awk <span class="s1">'{print $1}'</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">"</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">"</span> <span class="s2">"twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">"</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">"</span><span class="nv">$meat</span><span class="s2">"</span> 1080p60 --player <span class="s2">$"{PLAYER}"</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they’re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user’s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don’t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don’t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,119 +1,93 @@
|
|||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en"><head>
|
||||
<meta name="generator" content="Hugo 0.148.2">
|
||||
<meta name="generator" content="Hugo 0.148.2"><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/" />
|
||||
<title>James' Blog :-)</title>
|
||||
<link rel="canonical" href="http://localhost:1313/" />
|
||||
<title>James' Blog</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
<input type="text" id="search" placeholder="🔎 leaf through the archive"/>
|
||||
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<ul id="results">
|
||||
|
||||
<li><a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a></li>
|
||||
|
||||
<li><a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a></li>
|
||||
|
||||
<li><a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a></li>
|
||||
|
||||
<li><a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a></li>
|
||||
|
||||
<li><a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a></li>
|
||||
|
||||
<li><a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a></li>
|
||||
|
||||
<li><a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a></li>
|
||||
|
||||
<li><a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a></li>
|
||||
|
||||
<li><a href="/translating-docker-to-nix/">Translating docker to nix?!</a></li>
|
||||
|
||||
<li><a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a></li>
|
||||
|
||||
<li><a href="/python-podcast-scripting/">Python podcast scripting</a></li>
|
||||
|
||||
<li><a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a></li>
|
||||
|
||||
<li><a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a></li>
|
||||
|
||||
<li><a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a></li>
|
||||
|
||||
<li><a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a></li>
|
||||
|
||||
<li><a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a></li>
|
||||
|
||||
<li><a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a></li>
|
||||
|
||||
<li><a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a></li>
|
||||
|
||||
<li><a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a></li>
|
||||
|
||||
<li><a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a></li>
|
||||
|
||||
<li><a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/">over-engineered (?) nixos blog deployment setup</a> -<small><time>Aug 11, 2025</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/">so you want to write a neovim plugin with lua</a> -<small><time>Apr 6, 2024</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/">making nix-colors talk to neovim</a> -<small><time>Aug 18, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/">vanilla javascript theme toggle for simpletons</a> -<small><time>Jun 26, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/">tailscale, caddy, and nixos containers - a match made in heaven</a> -<small><time>May 16, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/">learning about qtile widgets via the medium of cricket</a> -<small><time>Apr 3, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/theming-nirvana/">theming nirvana</a> -<small><time>Mar 13, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/translating-docker-to-nix/">translating docker to nix?!</a> -<small><time>Feb 28, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/">simple nixos config for vps static site</a> -<small><time>Jan 29, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/">podcast setup for broke boys whose trash phone cant hack modern apps</a> -<small><time>Jan 24, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/">elite bread dough for lazy boys</a> -<small><time>Jan 22, 2023</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/multi-user-qtile-fiddling/">multi user qtile fiddling</a> -<small><time>Dec 20, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/">teeny tiny bash fetch script</a> -<small><time>Dec 10, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/">get the thoughts out of your head and into a digital format with this python journal script</a> -<small><time>Dec 1, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/lowkey-emacs-setup/">lowkey emacs setup</a> -<small><time>Nov 18, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/">setting up a lean mean hugo blogging theme</a> -<small><time>Nov 10, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/">chess.com api and the continuing search for en passant checkmate</a> -<small><time>Nov 8, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/">chess.com api and the search for en passant checkmate</a> -<small><time>Oct 26, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/">declarative firefox config with home-manager on nixos</a> -<small><time>Oct 2, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">upgrade your qtile setup with a cute dropdown terminal</a> -<small><time>Sep 23, 2022</time></small>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/">rudimentary local scrobbling with bash</a> -<small><time>Sep 13, 2022</time></small>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
1
public/index.json
Normal file
1
public/index.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,40 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/info/" />
|
||||
<link rel="canonical" href="http://localhost:1313/info/" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1></h1>
|
||||
<div></div>
|
||||
</header><p>This is a place to document bits and bobs I’ve been up to that have interested me.
|
||||
<header id="post-header">
|
||||
<h3></h3>
|
||||
<div></div>
|
||||
</header><p>This is a place to document bits and bobs I’ve been up to that have interested me.
|
||||
Expect linux and self-hosting tinkering, some novice programming, and maybe the occasional recipe.
|
||||
I tend to be a fool so take anything written here with a pinch of salt :)</p>
|
||||
<ul>
|
||||
<li><a href="../index.xml">rss HERE!!</a></li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
46
public/js/search.js
Normal file
46
public/js/search.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
document.addEventListener("DOMContentLoaded", function () {
|
||||
let index = [];
|
||||
|
||||
// Load JSON index
|
||||
fetch("/index.json")
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
index = data;
|
||||
console.log("Index loaded:", index.length, "posts");
|
||||
})
|
||||
.catch((err) => console.error("Error loading index.json", err));
|
||||
|
||||
const searchInput = document.getElementById("search");
|
||||
const resultsList = document.getElementById("results");
|
||||
|
||||
function runSearch() {
|
||||
const query = searchInput.value.trim().toLowerCase();
|
||||
resultsList.innerHTML = "";
|
||||
|
||||
if (!query) return;
|
||||
|
||||
// filter out posts that don't match
|
||||
const matches = index.filter(
|
||||
(post) =>
|
||||
post.title.toLowerCase().includes(query) ||
|
||||
post.content.toLowerCase().includes(query),
|
||||
);
|
||||
|
||||
if (matches.length === 0) {
|
||||
resultsList.innerHTML = "<li>No results found.</li>";
|
||||
return;
|
||||
}
|
||||
|
||||
// Render matching posts
|
||||
matches.forEach((post) => {
|
||||
const li = document.createElement("li");
|
||||
const link = document.createElement("a");
|
||||
link.href = post.url;
|
||||
link.textContent = post.title;
|
||||
li.appendChild(link);
|
||||
resultsList.appendChild(li);
|
||||
});
|
||||
}
|
||||
|
||||
searchInput.addEventListener("input", runSearch);
|
||||
});
|
||||
43
public/js/toggle.js
Normal file
43
public/js/toggle.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
function toggleTheme() {
|
||||
|
||||
var stylesheet = document.getElementById('stylesheet');
|
||||
|
||||
if (stylesheet.getAttribute('href') === '/css/dark.css') {
|
||||
|
||||
// update stylesheet and store
|
||||
stylesheet.setAttribute('href', '/css/light.css');
|
||||
localStorage.setItem('stylesheet', '/css/light.css');
|
||||
// update button emoji and store
|
||||
button = document.getElementById('toggle-button').innerText = '🌚'
|
||||
localStorage.setItem('button-emoji', '🌚');
|
||||
|
||||
} else {
|
||||
|
||||
// update stylesheet and store
|
||||
stylesheet.setAttribute('href', '/css/dark.css');
|
||||
localStorage.setItem('stylesheet', '/css/dark.css');
|
||||
// update button emoji and store
|
||||
button = document.getElementById('toggle-button').innerText = '🌞'
|
||||
localStorage.setItem('button-emoji', '🌞');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
|
||||
// get stored style
|
||||
var storedStyle = localStorage.getItem('stylesheet');
|
||||
var stylesheet = document.getElementById('stylesheet');
|
||||
// get stored emoji
|
||||
var storedEmoji = localStorage.getItem('button-emoji');
|
||||
var button = document.getElementById('toggle-button')
|
||||
|
||||
// set stored style it exists
|
||||
if (storedStyle) {
|
||||
stylesheet.setAttribute('href', storedStyle);
|
||||
}
|
||||
// set stored emoji it exists
|
||||
if (storedEmoji) {
|
||||
button.innerText = storedEmoji;
|
||||
}
|
||||
});
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/" />
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link rel="canonical" href="http://localhost:1313/learning-about-qtile-widgets-with-cricket/" />
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>learning about qtile widgets via the medium of cricket</h1>
|
||||
<div>
|
||||
<time>April 3, 2023</time>
|
||||
</div>
|
||||
</header><p>I’m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<header id="post-header">
|
||||
<h3>Learning about qtile widgets with cricket</h3>
|
||||
<div>
|
||||
<time>April 3, 2023</time>
|
||||
</div>
|
||||
</header><p>I’m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I’m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
<p>As far as I can tell from looking at the code for some of the <a href="https://github.com/qtile/qtile/tree/master/libqtile/widget">built-in widgets</a> and <a href="https://docs.qtile.org/en/latest/manual/howto/widget.html">this very helpful guide</a>, a basic hello world widget would look something like this.</p>
|
||||
|
|
@ -129,9 +136,18 @@
|
|||
</span></span><span class="line"><span class="cl"><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>Happy widget writing.</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
|
||||
<link rel="canonical" href="http://localhost:1313/links/" />
|
||||
|
||||
<a rel="me" href="https://exuberant.men/@james"></a>
|
||||
<title></title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="http://localhost:1313/">wretched.place</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="info">info</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1></h1>
|
||||
<div></div>
|
||||
</header><p><a href="/index.xml">rss</a></p>
|
||||
<p><a href="https://github.com/ryfrd">github</a></p>
|
||||
<p><a href="https://matrix.to/#/@james:brutal.dance">matrix</a></p>
|
||||
<p><a href="https://exuberant.men/@james">mastodon</a></p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<small>made with <a href="https://gohugo.io">hugo</a> and <a href="https://github.com/LukasJoswiak/etch">etch</a> :)</small>
|
||||
<br>
|
||||
<small><a href="/index.xml">rss</a></small>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/lowkey-emacs-setup/" />
|
||||
<title>lowkey emacs setup</title>
|
||||
<link rel="canonical" href="http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/" />
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>lowkey emacs setup</h1>
|
||||
<div>
|
||||
<time>November 18, 2022</time>
|
||||
</div>
|
||||
</header><p>About a month ago I was a little bored and thought I’d give emacs a go. There’s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There’s also the quite jarring default theme which wasn’t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I’ve landed on a simple little setup that I’ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<header id="post-header">
|
||||
<h3>Lowkey emacs setup bits and bobs</h3>
|
||||
<div>
|
||||
<time>November 18, 2022</time>
|
||||
</div>
|
||||
</header><p>About a month ago I was a little bored and thought I’d give emacs a go. There’s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There’s also the quite jarring default theme which wasn’t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I’ve landed on a simple little setup that I’ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you’re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nv">load-theme</span> <span class="ss">'misterioso</span> <span class="no">t</span><span class="p">)</span>
|
||||
|
|
@ -101,9 +108,18 @@
|
|||
</span></span></code></pre></div><p>Here’s a little pic of the current setup :)</p>
|
||||
<p><img src="/image/emacs.png" alt="emacs"></p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/" />
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link rel="canonical" href="http://localhost:1313/making-nix-colors-talk-to-neovim/" />
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>making nix-colors talk to neovim</h1>
|
||||
<div>
|
||||
<time>August 18, 2023</time>
|
||||
</div>
|
||||
</header><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
<header id="post-header">
|
||||
<h3>Making nix-colors talk to neovim</h3>
|
||||
<div>
|
||||
<time>August 18, 2023</time>
|
||||
</div>
|
||||
</header><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
<p>Beneath is a little snippet of how you could make it all happen.</p>
|
||||
|
|
@ -71,9 +78,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"><span class="p">}</span>
|
||||
</span></span></code></pre></div><p>Happy theming!</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/multi-user-qtile-fiddling/" />
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link rel="canonical" href="http://localhost:1313/multi-user-qtile-fiddling/" />
|
||||
<title>Multi user qtile fiddling</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>multi user qtile fiddling</h1>
|
||||
<div>
|
||||
<time>December 20, 2022</time>
|
||||
</div>
|
||||
</header><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<header id="post-header">
|
||||
<h3>Multi user qtile fiddling</h3>
|
||||
<div>
|
||||
<time>December 20, 2022</time>
|
||||
</div>
|
||||
</header><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it’’s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">if</span> <span class="n">socket</span><span class="o">.</span><span class="n">gethostname</span><span class="p">()</span> <span class="o">==</span> <span class="s1">'baron'</span><span class="p">:</span>
|
||||
|
|
@ -97,9 +104,18 @@
|
|||
</span></span><span class="line"><span class="cl"> <span class="n">subprocess</span><span class="o">.</span><span class="n">Popen</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Of course, there are many ways that this could all be achievd but I think it’s quite neat having it all in my one qtile config. That’s about it for today. lots of love x</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,119 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
|
||||
<link rel="canonical" href="http://localhost:1313/over-engieered-nixos-blog-deployment-setup/" />
|
||||
<title>Over-engieered nixos blog deployment setup</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="http://localhost:1313/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="info">info</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>Over-engieered nixos blog deployment setup</h1>
|
||||
<div>
|
||||
<time>August 11, 2025</time>
|
||||
</div>
|
||||
</header><p>As is traditional with people hosting their own blog I’m going to do a post detailing EXACTLY how I’m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
Qute an easy, efficient solution; it worked well.
|
||||
But not very nixos; far too simple, not sufficiently over-engieered.
|
||||
So in true nixos fashion I decided I’d spend a couple of hours sorting the problem so I’d maybe save a minute once a year when I write a blog post.</p>
|
||||
<h3 id="remote-rebuilds">Remote Rebuilds</h3>
|
||||
<p>First, I’ll show the fancy way to rebuild your remote nixos systems via ssh.
|
||||
In my case, this means I can rebuild my hetzner box from my laptop.
|
||||
You can read the wiki about it <a href="https://wiki.nixos.org/wiki/Nixos-rebuild#Deploying_on_other_machines">here</a>.</p>
|
||||
<p>This sets up ssh with key-based authentication and lets our local user in.
|
||||
This config belongs on the remote machine.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-nix" data-lang="nix"><span class="line"><span class="cl"><span class="n">users</span><span class="o">.</span><span class="n">users</span><span class="o">.</span><span class="n">blog-king</span><span class="o">.</span><span class="n">openssh</span><span class="o">.</span><span class="n">authorizedKeys</span><span class="o">.</span><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># ssh public key on computer you're deploying from</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPzFa1hmmmmmPL5HvJZhXVEaWiZIMi34oR6AOcaaaaaaa"</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">];</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="n">nix</span><span class="o">.</span><span class="n">settings</span><span class="o">.</span><span class="n">trusted-users</span> <span class="o">=</span> <span class="p">[</span> <span class="s2">"blog-king"</span> <span class="p">];</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># ssh daemon</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="n">services</span><span class="o">.</span><span class="n">openssh</span> <span class="o">=</span> <span class="p">{</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">enable</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">openFirewall</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">settings</span> <span class="o">=</span> <span class="p">{</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">PasswordAuthentication</span> <span class="o">=</span> <span class="no">false</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">PermitRootLogin</span> <span class="o">=</span> <span class="s2">"no"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">};</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">};</span>
|
||||
</span></span></code></pre></div><p>Once you have this going on your remote machine (in my case the hetzner vps) you should be able to rebuild the remote machine with <code>nixos-rebuild --target-host blog-king@remote-ip-here --ask-sudo-password switch</code>.
|
||||
The <code>--ask-sudo-password</code> is not required if you ssh in as root though that would be a touch gauche.</p>
|
||||
<h3 id="caddy">Caddy</h3>
|
||||
<p>You can do this with whatever your preferred webserver is.
|
||||
I am a caddy stan.
|
||||
This opens the necessary ports in the firewall and sets up caddy in file server mode pointing at <code>/etc/blog</code>.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-nix" data-lang="nix"><span class="line"><span class="cl"><span class="n">networking</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">allowedTCPPorts</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="mi">80</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="mi">443</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">];</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="n">services</span><span class="o">.</span><span class="n">caddy</span> <span class="o">=</span> <span class="p">{</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">enable</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">extraConfig</span> <span class="o">=</span> <span class="s1">''
|
||||
</span></span></span><span class="line"><span class="cl"><span class="s1"> blog.example.org {
|
||||
</span></span></span><span class="line"><span class="cl"><span class="s1"> root * /etc/blog
|
||||
</span></span></span><span class="line"><span class="cl"><span class="s1"> file_server
|
||||
</span></span></span><span class="line"><span class="cl"><span class="s1"> }
|
||||
</span></span></span><span class="line"><span class="cl"><span class="s1"> ''</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">};</span>
|
||||
</span></span></code></pre></div><h3 id="getting-the-files-from-git">Getting the files from git</h3>
|
||||
<p>We have a web server pointing at <code>/etc/blog</code>.
|
||||
The last piece of the puzzle is to get the static files from our git repo and spit them out in that directory.</p>
|
||||
<p>I’m using the <code>fetchFromGitea</code> helper here which works for gitea and forgejo instances.
|
||||
The <code>fetchFromGitHub</code> helper would look very similar.</p>
|
||||
<p>You can get the <code>rev</code> and <code>sha256</code> of the commit using <code>nix-prefetch-git</code>.
|
||||
Also note the little <code>/public</code> at the end of the <code>source</code> string.
|
||||
That’s the directory of the git repo that the wesite source lives.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-nix" data-lang="nix"><span class="line"><span class="cl"><span class="n">environment</span><span class="o">.</span><span class="n">etc</span><span class="o">.</span><span class="s2">"blog"</span> <span class="o">=</span> <span class="p">{</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">enable</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">target</span> <span class="o">=</span> <span class="s2">"blog"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">source</span> <span class="o">=</span> <span class="s2">"</span><span class="si">${</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">pkgs</span><span class="o">.</span><span class="n">fetchFromGitea</span> <span class="p">{</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">domain</span> <span class="o">=</span> <span class="s2">"git.dymc.win"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">owner</span> <span class="o">=</span> <span class="s2">"james"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">repo</span> <span class="o">=</span> <span class="s2">"blog"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">rev</span> <span class="o">=</span> <span class="s2">"32d81f01388c88a259eed2ba52f4545dbcb1eb07"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">sha256</span> <span class="o">=</span> <span class="s2">"173g99dj8y4sw1v7f1s5f7zgcrrlr6dly9n6ysr2i4jg095lkxw8"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="si">}</span><span class="s2">/public"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">user</span> <span class="o">=</span> <span class="s2">"caddy"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">group</span> <span class="o">=</span> <span class="s2">"caddy"</span><span class="p">;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">};</span>
|
||||
</span></span></code></pre></div><p>So now with all that setup the blog post work flow is:</p>
|
||||
<ul>
|
||||
<li>Commit rebuilt website to repo</li>
|
||||
<li>Update the <code>rev</code> and <code>sha256</code> to the new commit (this is annoying and I’m trying to work out a good way to automate it)</li>
|
||||
<li>Rebuild vps from laptop</li>
|
||||
</ul>
|
||||
<p>Not necessarily faster than the old rsync method but it’s pretty damn declarative.</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>~~~ made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a> ~~~</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/" />
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link rel="canonical" href="http://localhost:1313/over-engineered-nixos-blog-deployment-setup/" />
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>over-engineered (?) nixos blog deployment setup</h1>
|
||||
<div>
|
||||
<time>August 11, 2025</time>
|
||||
</div>
|
||||
</header><p>As is traditional with people hosting their own blog I’m going to do a post detailing EXACTLY how I’m hosting my blog.
|
||||
<header id="post-header">
|
||||
<h3>Over-engineered (?) nixos blog deployment setup</h3>
|
||||
<div>
|
||||
<time>August 11, 2025</time>
|
||||
</div>
|
||||
</header><p>As is traditional with people hosting their own blog I’m going to do a post detailing EXACTLY how I’m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
|
|
@ -111,9 +118,18 @@ That’s the directory of the git repo that the website source lives.</p>
|
|||
</ul>
|
||||
<p>Not necessarily faster than the old rsync method but it’s pretty damn declarative, that’s for sure.</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,115 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/posts/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/posts/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/posts/" />
|
||||
<link rel="canonical" href="http://localhost:1313/posts/" />
|
||||
<title>Posts</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content"><ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/">over-engineered (?) nixos blog deployment setup</a> -<small><time>Aug 11, 2025</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/">so you want to write a neovim plugin with lua</a> -<small><time>Apr 6, 2024</time></small>
|
||||
</li>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/">making nix-colors talk to neovim</a> -<small><time>Aug 18, 2023</time></small>
|
||||
</li>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/">vanilla javascript theme toggle for simpletons</a> -<small><time>Jun 26, 2023</time></small>
|
||||
</li>
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/">tailscale, caddy, and nixos containers - a match made in heaven</a> -<small><time>May 16, 2023</time></small>
|
||||
</li>
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/">learning about qtile widgets via the medium of cricket</a> -<small><time>Apr 3, 2023</time></small>
|
||||
</li>
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/theming-nirvana/">theming nirvana</a> -<small><time>Mar 13, 2023</time></small>
|
||||
</li>
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/translating-docker-to-nix/">translating docker to nix?!</a> -<small><time>Feb 28, 2023</time></small>
|
||||
</li>
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/">simple nixos config for vps static site</a> -<small><time>Jan 29, 2023</time></small>
|
||||
</li>
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/">podcast setup for broke boys whose trash phone cant hack modern apps</a> -<small><time>Jan 24, 2023</time></small>
|
||||
</li>
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/">elite bread dough for lazy boys</a> -<small><time>Jan 22, 2023</time></small>
|
||||
</li>
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/multi-user-qtile-fiddling/">multi user qtile fiddling</a> -<small><time>Dec 20, 2022</time></small>
|
||||
</li>
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/">teeny tiny bash fetch script</a> -<small><time>Dec 10, 2022</time></small>
|
||||
</li>
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/">get the thoughts out of your head and into a digital format with this python journal script</a> -<small><time>Dec 1, 2022</time></small>
|
||||
</li>
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/lowkey-emacs-setup/">lowkey emacs setup</a> -<small><time>Nov 18, 2022</time></small>
|
||||
</li>
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/">setting up a lean mean hugo blogging theme</a> -<small><time>Nov 10, 2022</time></small>
|
||||
</li>
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/">chess.com api and the continuing search for en passant checkmate</a> -<small><time>Nov 8, 2022</time></small>
|
||||
</li>
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/">chess.com api and the search for en passant checkmate</a> -<small><time>Oct 26, 2022</time></small>
|
||||
</li>
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/">declarative firefox config with home-manager on nixos</a> -<small><time>Oct 2, 2022</time></small>
|
||||
</li>
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">upgrade your qtile setup with a cute dropdown terminal</a> -<small><time>Sep 23, 2022</time></small>
|
||||
</li>
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/">rudimentary local scrobbling with bash</a> -<small><time>Sep 13, 2022</time></small>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Posts on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/posts/</link>
|
||||
<description>Recent content in Posts on James' Blog :-)</description>
|
||||
<title>Posts on James' Blog</title>
|
||||
<link>http://localhost:1313/posts/</link>
|
||||
<description>Recent content in Posts on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Mon, 11 Aug 2025 00:00:00 +0000</lastBuildDate>
|
||||
<lastBuildDate>Wed, 13 Aug 2025 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/posts/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/posts/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/" />
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link rel="canonical" href="http://localhost:1313/python-podcast-scripting/" />
|
||||
<title>Python podcast scripting</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>podcast setup for broke boys whose trash phone cant hack modern apps</h1>
|
||||
<div>
|
||||
<time>January 24, 2023</time>
|
||||
</div>
|
||||
</header><p>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:</p>
|
||||
<header id="post-header">
|
||||
<h3>Python podcast scripting</h3>
|
||||
<div>
|
||||
<time>January 24, 2023</time>
|
||||
</div>
|
||||
</header><p>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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -109,9 +116,18 @@
|
|||
</span></span><span class="line"><span class="cl"><span class="n">trim</span><span class="p">()</span>
|
||||
</span></span></code></pre></div><p>Of course this slightly ramshackle approach is certainly not for everyone lol but as it stands it’s working quite nicely for me. Lots of love and happy listening :)</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/" />
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link rel="canonical" href="http://localhost:1313/rudimentary-local-scrobbling-with-bash/" />
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>rudimentary local scrobbling with bash</h1>
|
||||
<div>
|
||||
<time>September 13, 2022</time>
|
||||
</div>
|
||||
</header><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I’ll be talking specifically about my setup for recording the albums I’ve been listening to.</p>
|
||||
<header id="post-header">
|
||||
<h3>Rudimentary local scrobbling with bash</h3>
|
||||
<div>
|
||||
<time>September 13, 2022</time>
|
||||
</div>
|
||||
</header><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I’ll be talking specifically about my setup for recording the albums I’ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET’S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I’m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
<p><code>/home/randy/music/Beyonce/Lemonade/</code></p>
|
||||
|
|
@ -51,9 +58,18 @@
|
|||
</span></span></code></pre></div><p>So these are just a few examples; the real point is once you have that file of three columns the world is your oyster. You could probably even use something a little less cumbersome such as python.</p>
|
||||
<p>Finally, disclaimer: I am a bash amateur so I hope nothing you’ve seen here was too upsetting. Lots of love x</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
50
public/search/index.html
Normal file
50
public/search/index.html
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="http://localhost:1313/search/" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h3></h3>
|
||||
<div></div>
|
||||
</header><h3 id="archival-data">archival data</h3>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/" />
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>setting up a lean mean hugo blogging theme</h1>
|
||||
<div>
|
||||
<time>November 10, 2022</time>
|
||||
</div>
|
||||
</header><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you’ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you’ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I’m using on this site that is also very simple (as you can probably see from the website lol). Once you’ve got a theme with (I’m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you’ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">"mcl"</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there’s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there’s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we’ve got the directory what’s happening where admin out the way let’s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial "header.html" . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p"><</span><span class="nt">p</span><span class="p">></span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I've been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p"></</span><span class="nt">p</span><span class="p">></span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p"><</span><span class="nt">h3</span><span class="p">></span> <span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"{{ .RelPermalink }}"</span><span class="p">></span>{{ .Title }}<span class="p"></</span><span class="nt">a</span><span class="p">></</span><span class="nt">h3</span><span class="p">></span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p"><</span><span class="nt">br</span><span class="p">><</span><span class="nt">br</span><span class="p">></span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format "06 Jan, 2006" }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms "tags") }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">'{{ .Permalink }}'</span><span class="p">></span>{{ .LinkTitle }}<span class="p"></</span><span class="nt">a</span><span class="p">></span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial "footer.html" . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I’m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/" />
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link rel="canonical" href="http://localhost:1313/simple-nixos-config-for-vps-static-site/" />
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>simple nixos config for vps static site</h1>
|
||||
<div>
|
||||
<time>January 29, 2023</time>
|
||||
</div>
|
||||
</header><p>Setting up a little static site is something I’ve done a few different times on a few different operating systems. It’s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let’s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<header id="post-header">
|
||||
<h3>Simple nixos config for vps static site</h3>
|
||||
<div>
|
||||
<time>January 29, 2023</time>
|
||||
</div>
|
||||
</header><p>Setting up a little static site is something I’ve done a few different times on a few different operating systems. It’s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let’s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I’m going to go through a bit of the nixos config I’ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
<p>Having a way to to get into your server is useful. Managing ssh on nix is very simple; this enables the ssh daemon, tells it what port to run on, disables plain text passwords, and disables root login.</p>
|
||||
|
|
@ -77,9 +84,18 @@
|
|||
</span></span><span class="line"><span class="cl"><span class="p">};</span>
|
||||
</span></span></code></pre></div><p>This means I can just rsync the updated site from my laptop to the server and it’ll be updated within the hour. Good enough for me.</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -2,140 +2,140 @@
|
|||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<url>
|
||||
<loc>https://nonsense.dymc.win/</loc>
|
||||
<loc>http://localhost:1313/tags/bash-script-twitch/</loc>
|
||||
<lastmod>2025-08-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</loc>
|
||||
<lastmod>2025-08-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>http://localhost:1313/</loc>
|
||||
<lastmod>2025-08-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>http://localhost:1313/posts/</loc>
|
||||
<lastmod>2025-08-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>http://localhost:1313/tags/</loc>
|
||||
<lastmod>2025-08-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>http://localhost:1313/tags/nixos/</loc>
|
||||
<lastmod>2025-08-11T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/nixos/</loc>
|
||||
<loc>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</loc>
|
||||
<lastmod>2025-08-11T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</loc>
|
||||
<lastmod>2025-08-11T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/posts/</loc>
|
||||
<lastmod>2025-08-11T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/</loc>
|
||||
<lastmod>2025-08-11T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/lua/</loc>
|
||||
<loc>http://localhost:1313/tags/lua/</loc>
|
||||
<lastmod>2024-04-06T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/neovim/</loc>
|
||||
<loc>http://localhost:1313/tags/neovim/</loc>
|
||||
<lastmod>2024-04-06T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</loc>
|
||||
<loc>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</loc>
|
||||
<lastmod>2024-04-06T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/home-manager/</loc>
|
||||
<loc>http://localhost:1313/tags/home-manager/</loc>
|
||||
<lastmod>2023-08-18T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</loc>
|
||||
<loc>http://localhost:1313/making-nix-colors-talk-to-neovim/</loc>
|
||||
<lastmod>2023-08-18T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/nix-colors/</loc>
|
||||
<loc>http://localhost:1313/tags/nix-colors/</loc>
|
||||
<lastmod>2023-08-18T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/css/</loc>
|
||||
<loc>http://localhost:1313/tags/css/</loc>
|
||||
<lastmod>2023-06-26T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/javascript/</loc>
|
||||
<loc>http://localhost:1313/tags/javascript/</loc>
|
||||
<lastmod>2023-06-26T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</loc>
|
||||
<loc>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</loc>
|
||||
<lastmod>2023-06-26T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/caddy/</loc>
|
||||
<loc>http://localhost:1313/tags/caddy/</loc>
|
||||
<lastmod>2023-05-16T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/self-hosting/</loc>
|
||||
<loc>http://localhost:1313/tags/self-hosting/</loc>
|
||||
<lastmod>2023-05-16T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/tailscale/</loc>
|
||||
<loc>http://localhost:1313/tags/tailscale/</loc>
|
||||
<lastmod>2023-05-16T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</loc>
|
||||
<loc>http://localhost:1313/tailscale-caddy-and-nixos-containers/</loc>
|
||||
<lastmod>2023-05-16T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</loc>
|
||||
<loc>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</loc>
|
||||
<lastmod>2023-04-03T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/python/</loc>
|
||||
<loc>http://localhost:1313/tags/python/</loc>
|
||||
<lastmod>2023-04-03T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/qtile/</loc>
|
||||
<loc>http://localhost:1313/tags/qtile/</loc>
|
||||
<lastmod>2023-04-03T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/theming-nirvana/</loc>
|
||||
<loc>http://localhost:1313/achieve-peak-rice-with-nix-colors/</loc>
|
||||
<lastmod>2023-03-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/docker/</loc>
|
||||
<loc>http://localhost:1313/tags/docker/</loc>
|
||||
<lastmod>2023-02-28T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/podman/</loc>
|
||||
<loc>http://localhost:1313/tags/podman/</loc>
|
||||
<lastmod>2023-02-28T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/translating-docker-to-nix/</loc>
|
||||
<loc>http://localhost:1313/translating-docker-to-nix/</loc>
|
||||
<lastmod>2023-02-28T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</loc>
|
||||
<loc>http://localhost:1313/simple-nixos-config-for-vps-static-site/</loc>
|
||||
<lastmod>2023-01-29T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</loc>
|
||||
<loc>http://localhost:1313/python-podcast-scripting/</loc>
|
||||
<lastmod>2023-01-24T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/cooking/</loc>
|
||||
<loc>http://localhost:1313/bread-dough-for-lazy-boys/</loc>
|
||||
<lastmod>2023-01-22T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</loc>
|
||||
<loc>http://localhost:1313/tags/cooking/</loc>
|
||||
<lastmod>2023-01-22T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/multi-user-qtile-fiddling/</loc>
|
||||
<loc>http://localhost:1313/multi-user-qtile-fiddling/</loc>
|
||||
<lastmod>2022-12-20T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/bash/</loc>
|
||||
<loc>http://localhost:1313/tags/bash/</loc>
|
||||
<lastmod>2022-12-10T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</loc>
|
||||
<loc>http://localhost:1313/teeny-tiny-bash-fetch-script/</loc>
|
||||
<lastmod>2022-12-10T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</loc>
|
||||
<loc>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</loc>
|
||||
<lastmod>2022-12-01T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/emacs/</loc>
|
||||
<loc>http://localhost:1313/tags/emacs/</loc>
|
||||
<lastmod>2022-11-18T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/lowkey-emacs-setup/</loc>
|
||||
<loc>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</loc>
|
||||
<lastmod>2022-11-18T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/hugo/</loc>
|
||||
<lastmod>2022-11-10T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</loc>
|
||||
<lastmod>2022-11-10T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/chess/</loc>
|
||||
<loc>http://localhost:1313/tags/chess/</loc>
|
||||
<lastmod>2022-11-08T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</loc>
|
||||
<loc>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</loc>
|
||||
<lastmod>2022-11-08T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</loc>
|
||||
<loc>http://localhost:1313/the-search-for-en-passant-checkmates/</loc>
|
||||
<lastmod>2022-10-26T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</loc>
|
||||
<loc>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</loc>
|
||||
<lastmod>2022-10-02T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</loc>
|
||||
<loc>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</loc>
|
||||
<lastmod>2022-09-23T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/tags/music/</loc>
|
||||
<loc>http://localhost:1313/tags/music/</loc>
|
||||
<lastmod>2022-09-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</loc>
|
||||
<loc>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</loc>
|
||||
<lastmod>2022-09-13T00:00:00+00:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/info/</loc>
|
||||
<loc>http://localhost:1313/info/</loc>
|
||||
</url><url>
|
||||
<loc>https://nonsense.dymc.win/categories/</loc>
|
||||
<loc>http://localhost:1313/categories/</loc>
|
||||
</url>
|
||||
</urlset>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/" />
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link rel="canonical" href="http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/" />
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>so you want to write a neovim plugin with lua</h1>
|
||||
<div>
|
||||
<time>April 6, 2024</time>
|
||||
</div>
|
||||
</header><p>I’ve recently been messing around with writing neovim plugins.
|
||||
<header id="post-header">
|
||||
<h3>So you want to write a neovim plugin with lua</h3>
|
||||
<div>
|
||||
<time>April 6, 2024</time>
|
||||
</div>
|
||||
</header><p>I’ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There’s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
Beyond that, the thing I found most useful was simply reading the source of some popular plugins to get an idea of how things worked.
|
||||
|
|
@ -94,9 +101,18 @@ As a little coda, this is how you can use your fancy new plugin using <a href="h
|
|||
</span></span><span class="line"><span class="cl"><span class="p">})</span>
|
||||
</span></span></code></pre></div><p>Hope you’ve enjoyed.</p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
87
public/tags/bash-script-twitch/index.html
Normal file
87
public/tags/bash-script-twitch/index.html
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/bash-script-twitch/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="http://localhost:1313/tags/bash-script-twitch/" />
|
||||
<title>Bash, Script, Twitch</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/</link>
|
||||
<description>Recent content on James' Blog :-)</description>
|
||||
<title>Bash, Script, Twitch on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/bash-script-twitch/</link>
|
||||
<description>Recent content in Bash, Script, Twitch on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Mon, 11 Aug 2025 00:00:00 +0000</lastBuildDate>
|
||||
<lastBuildDate>Wed, 13 Aug 2025 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/bash-script-twitch/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
@ -1,41 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/bash/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/bash/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/bash/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/bash/" />
|
||||
<title>Bash</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Bash</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/">teeny tiny bash fetch script</a> -<small><time>Dec 10, 2022</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/">rudimentary local scrobbling with bash</a> -<small><time>Sep 13, 2022</time></small>
|
||||
</li>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</ul>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Bash on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/bash/</link>
|
||||
<description>Recent content in Bash on James' Blog :-)</description>
|
||||
<title>Bash on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/bash/</link>
|
||||
<description>Recent content in Bash on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Sat, 10 Dec 2022 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/bash/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/bash/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/caddy/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/caddy/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/caddy/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/caddy/" />
|
||||
<title>Caddy</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Caddy</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/">tailscale, caddy, and nixos containers - a match made in heaven</a> -<small><time>May 16, 2023</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Caddy on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/caddy/</link>
|
||||
<description>Recent content in Caddy on James' Blog :-)</description>
|
||||
<title>Caddy on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/caddy/</link>
|
||||
<description>Recent content in Caddy on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Tue, 16 May 2023 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/caddy/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/caddy/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,41 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/chess/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/chess/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/chess/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/chess/" />
|
||||
<title>Chess</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Chess</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/">chess.com api and the continuing search for en passant checkmate</a> -<small><time>Nov 8, 2022</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/">chess.com api and the search for en passant checkmate</a> -<small><time>Oct 26, 2022</time></small>
|
||||
</li>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</ul>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Chess on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/chess/</link>
|
||||
<description>Recent content in Chess on James' Blog :-)</description>
|
||||
<title>Chess on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/chess/</link>
|
||||
<description>Recent content in Chess on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Tue, 08 Nov 2022 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/chess/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/chess/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/cooking/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/cooking/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/cooking/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/cooking/" />
|
||||
<title>Cooking</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Cooking</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/">elite bread dough for lazy boys</a> -<small><time>Jan 22, 2023</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Cooking on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/cooking/</link>
|
||||
<description>Recent content in Cooking on James' Blog :-)</description>
|
||||
<title>Cooking on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/cooking/</link>
|
||||
<description>Recent content in Cooking on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Sun, 22 Jan 2023 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/cooking/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/cooking/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/css/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/css/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/css/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/css/" />
|
||||
<title>Css</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Css</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/">vanilla javascript theme toggle for simpletons</a> -<small><time>Jun 26, 2023</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Css on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/css/</link>
|
||||
<description>Recent content in Css on James' Blog :-)</description>
|
||||
<title>Css on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/css/</link>
|
||||
<description>Recent content in Css on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Mon, 26 Jun 2023 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/css/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/css/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/docker/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/docker/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/docker/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/docker/" />
|
||||
<title>Docker</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Docker</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/translating-docker-to-nix/">translating docker to nix?!</a> -<small><time>Feb 28, 2023</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Docker on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/docker/</link>
|
||||
<description>Recent content in Docker on James' Blog :-)</description>
|
||||
<title>Docker on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/docker/</link>
|
||||
<description>Recent content in Docker on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Tue, 28 Feb 2023 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/docker/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/docker/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/emacs/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/emacs/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/emacs/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/emacs/" />
|
||||
<title>Emacs</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Emacs</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/lowkey-emacs-setup/">lowkey emacs setup</a> -<small><time>Nov 18, 2022</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Emacs on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/emacs/</link>
|
||||
<description>Recent content in Emacs on James' Blog :-)</description>
|
||||
<title>Emacs on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/emacs/</link>
|
||||
<description>Recent content in Emacs on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Fri, 18 Nov 2022 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/emacs/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/emacs/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,49 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/home-manager/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/home-manager/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/home-manager/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/home-manager/" />
|
||||
<title>Home-Manager</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Home-Manager</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/">making nix-colors talk to neovim</a> -<small><time>Aug 18, 2023</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/theming-nirvana/">theming nirvana</a> -<small><time>Mar 13, 2023</time></small>
|
||||
</li>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/multi-user-qtile-fiddling/">multi user qtile fiddling</a> -<small><time>Dec 20, 2022</time></small>
|
||||
</li>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/">declarative firefox config with home-manager on nixos</a> -<small><time>Oct 2, 2022</time></small>
|
||||
</li>
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
</ul>
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Home-Manager on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/home-manager/</link>
|
||||
<description>Recent content in Home-Manager on James' Blog :-)</description>
|
||||
<title>Home-Manager on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/home-manager/</link>
|
||||
<description>Recent content in Home-Manager on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Fri, 18 Aug 2023 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/home-manager/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/home-manager/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/hugo/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/hugo/" />
|
||||
<title>Hugo</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Hugo</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/">setting up a lean mean hugo blogging theme</a> -<small><time>Nov 10, 2022</time></small>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,113 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/" />
|
||||
<title>Tags</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Tags</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/nixos/">Nixos</a> -<small><time>Aug 11, 2025</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/lua/">Lua</a> -<small><time>Apr 6, 2024</time></small>
|
||||
</li>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/neovim/">Neovim</a> -<small><time>Apr 6, 2024</time></small>
|
||||
</li>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/home-manager/">Home-Manager</a> -<small><time>Aug 18, 2023</time></small>
|
||||
</li>
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/nix-colors/">Nix-Colors</a> -<small><time>Aug 18, 2023</time></small>
|
||||
</li>
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/css/">Css</a> -<small><time>Jun 26, 2023</time></small>
|
||||
</li>
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/javascript/">Javascript</a> -<small><time>Jun 26, 2023</time></small>
|
||||
</li>
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/caddy/">Caddy</a> -<small><time>May 16, 2023</time></small>
|
||||
</li>
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/self-hosting/">Self-Hosting</a> -<small><time>May 16, 2023</time></small>
|
||||
</li>
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/tailscale/">Tailscale</a> -<small><time>May 16, 2023</time></small>
|
||||
</li>
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/python/">Python</a> -<small><time>Apr 3, 2023</time></small>
|
||||
</li>
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/qtile/">Qtile</a> -<small><time>Apr 3, 2023</time></small>
|
||||
</li>
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/docker/">Docker</a> -<small><time>Feb 28, 2023</time></small>
|
||||
</li>
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/podman/">Podman</a> -<small><time>Feb 28, 2023</time></small>
|
||||
</li>
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/cooking/">Cooking</a> -<small><time>Jan 22, 2023</time></small>
|
||||
</li>
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/bash/">Bash</a> -<small><time>Dec 10, 2022</time></small>
|
||||
</li>
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/emacs/">Emacs</a> -<small><time>Nov 18, 2022</time></small>
|
||||
</li>
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/hugo/">Hugo</a> -<small><time>Nov 10, 2022</time></small>
|
||||
</li>
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/chess/">Chess</a> -<small><time>Nov 8, 2022</time></small>
|
||||
</li>
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/tags/music/">Music</a> -<small><time>Sep 13, 2022</time></small>
|
||||
</li>
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
</ul>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Tags on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/</link>
|
||||
<description>Recent content in Tags on James' Blog :-)</description>
|
||||
<title>Tags on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/</link>
|
||||
<description>Recent content in Tags on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Mon, 11 Aug 2025 00:00:00 +0000</lastBuildDate>
|
||||
<lastBuildDate>Wed, 13 Aug 2025 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/javascript/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/javascript/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/javascript/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/javascript/" />
|
||||
<title>Javascript</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Javascript</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/">vanilla javascript theme toggle for simpletons</a> -<small><time>Jun 26, 2023</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Javascript on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/javascript/</link>
|
||||
<description>Recent content in Javascript on James' Blog :-)</description>
|
||||
<title>Javascript on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/javascript/</link>
|
||||
<description>Recent content in Javascript on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Mon, 26 Jun 2023 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/javascript/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/javascript/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/lua/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/lua/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/lua/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/lua/" />
|
||||
<title>Lua</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Lua</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/">so you want to write a neovim plugin with lua</a> -<small><time>Apr 6, 2024</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Lua on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/lua/</link>
|
||||
<description>Recent content in Lua on James' Blog :-)</description>
|
||||
<title>Lua on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/lua/</link>
|
||||
<description>Recent content in Lua on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Sat, 06 Apr 2024 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/lua/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/lua/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="https://nonsense.dymc.win/tags/music/index.xml" title="James' Blog :-)">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/tags/music/index.xml" title="James' Blog">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/tags/music/" />
|
||||
<link rel="canonical" href="http://localhost:1313/tags/music/" />
|
||||
<title>Music</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<h3>Music</h3>
|
||||
<ul id="posts">
|
||||
<li>
|
||||
<a href="https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/">rudimentary local scrobbling with bash</a> -<small><time>Sep 13, 2022</time></small>
|
||||
</li>
|
||||
<main id="content">
|
||||
<a href="/handy-script-for-a-more-zen-twitch-experience/">Handy script for a more zen twitch experience</a>
|
||||
|
||||
</ul>
|
||||
<a href="/over-engineered-nixos-blog-deployment-setup/">Over-engineered (?) nixos blog deployment setup</a>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
<a href="/so-you-want-to-write-a-neovim-plugin-with-lua/">So you want to write a neovim plugin with lua</a>
|
||||
|
||||
<a href="/making-nix-colors-talk-to-neovim/">Making nix-colors talk to neovim</a>
|
||||
|
||||
<a href="/vanilla-javascript-theme-toggle-for-simpletons/">Vanilla javascript theme toggle for simpletons</a>
|
||||
|
||||
<a href="/tailscale-caddy-and-nixos-containers/">Tailscale, caddy, and nixos containers</a>
|
||||
|
||||
<a href="/learning-about-qtile-widgets-with-cricket/">Learning about qtile widgets with cricket</a>
|
||||
|
||||
<a href="/achieve-peak-rice-with-nix-colors/">Achieve peak rice with nix-colors</a>
|
||||
|
||||
<a href="/translating-docker-to-nix/">Translating docker to nix?!</a>
|
||||
|
||||
<a href="/simple-nixos-config-for-vps-static-site/">Simple nixos config for vps static site</a>
|
||||
|
||||
<a href="/python-podcast-scripting/">Python podcast scripting</a>
|
||||
|
||||
<a href="/bread-dough-for-lazy-boys/">Bread dough for lazy boys</a>
|
||||
|
||||
<a href="/multi-user-qtile-fiddling/">Multi user qtile fiddling</a>
|
||||
|
||||
<a href="/teeny-tiny-bash-fetch-script/">Teeny tiny bash fetch script</a>
|
||||
|
||||
<a href="/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/">Get the thoughts out of your head and into a digital format with this python journalling script</a>
|
||||
|
||||
<a href="/lowkey-emacs-setup-bits-and-bobs/">Lowkey emacs setup bits and bobs</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates-2-electric-boogaloo/">The search for en passant checkmates 2: Electric Boogaloo</a>
|
||||
|
||||
<a href="/the-search-for-en-passant-checkmates/">The search for en passant checkmates</a>
|
||||
|
||||
<a href="/declarative-firefox-config-with-home-manager-on-nixos/">Declarative firefox config with home-manager on nixos</a>
|
||||
|
||||
<a href="/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/">Upgrade your qtile setup with a cute dropdown terminal</a>
|
||||
|
||||
<a href="/rudimentary-local-scrobbling-with-bash/">Rudimentary local scrobbling with bash</a>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Music on James' Blog :-)</title>
|
||||
<link>https://nonsense.dymc.win/tags/music/</link>
|
||||
<description>Recent content in Music on James' Blog :-)</description>
|
||||
<title>Music on James' Blog</title>
|
||||
<link>http://localhost:1313/tags/music/</link>
|
||||
<description>Recent content in Music on James' Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-GB</language>
|
||||
<lastBuildDate>Tue, 13 Sep 2022 00:00:00 +0000</lastBuildDate>
|
||||
|
||||
<atom:link href="https://nonsense.dymc.win/tags/music/index.xml" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://localhost:1313/tags/music/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<title>Handy script for a more zen twitch experience</title>
|
||||
<link>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</link>
|
||||
<pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://localhost:1313/handy-script-for-a-more-zen-twitch-experience/</guid>
|
||||
<description><p>I like to watch twitch streams.
|
||||
Watching them in the browser at <code>twitch.tv</code> is generally not an experience which sparks joy though.
|
||||
I&rsquo;m buffering.
|
||||
I&rsquo;m declining cookies.
|
||||
I&rsquo;m getting spammed with notifications to claim a sick new overwatch skin.
|
||||
There&rsquo;s a little channel point button twerking for me to click it.
|
||||
You get the idea; it&rsquo;s a heavy noisy experience.</p>
|
||||
<p>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 <a href="https://github.com/streamlink/streamlink">streamlink</a>.
|
||||
Here it is:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">PLAYER</span><span class="o">=</span><span class="s2">&#34;mpv&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LAUNCHER</span><span class="o">=</span><span class="s2">&#34;tofi&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">NOTIFY</span><span class="o">=</span><span class="s2">&#34;dunstify&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># you need an api key, get them here</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># https://dev.twitch.tv/docs/api/get-started/</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_ID</span><span class="o">=</span><span class="s2">&#34;id-here&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">CLIENT_SECRET</span><span class="o">=</span><span class="s2">&#34;secret-here-please-sssshh&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># list of streams to check</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">STREAMS</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;limmy&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;fl0m&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;northernlion&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;caedrel&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># reassure user that something is happening</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- checking who&#39;s live beep boop be patient&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># get auth token from twitch</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">ACCESS_TOKEN</span><span class="o">=</span><span class="k">$(</span>curl -s -X POST <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://id.twitch.tv/oauth2/token&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_id=</span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;client_secret=</span><span class="nv">$CLIENT_SECRET</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s2">&#34;grant_type=client_credentials&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> jq -r <span class="s1">&#39;.access_token&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># define empty list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">LIVE</span><span class="o">=()</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># loop through streams, check if live and append info to list</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">for</span> STREAM in <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STREAMS</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">do</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">RESPONSE</span><span class="o">=</span><span class="k">$(</span>curl -s -H <span class="s2">&#34;Client-ID: </span><span class="nv">$CLIENT_ID</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s2">&#34;Authorization: Bearer </span><span class="nv">$ACCESS_TOKEN</span><span class="s2">&#34;</span> <span class="se">\
|
||||
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="s2">&#34;https://api.twitch.tv/helix/streams?user_login=</span><span class="nv">$STREAM</span><span class="s2">&#34;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE_STATUS</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq <span class="s1">&#39;.data | length&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="o">[</span> <span class="s2">&#34;</span><span class="nv">$LIVE_STATUS</span><span class="s2">&#34;</span> -gt <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">TITLE</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].title&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">GAME</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$RESPONSE</span><span class="s2">&#34;</span> <span class="p">|</span> jq -r <span class="s1">&#39;.data[0].game_name&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">LIVE</span><span class="o">+=(</span><span class="s2">&#34;</span><span class="nv">$STREAM</span><span class="s2"> | </span><span class="nv">$GAME</span><span class="s2"> | </span><span class="nv">$TITLE</span><span class="s2">&#34;</span><span class="o">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="k">fi</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="c1"># pipe list items into tofi with new lines at the end</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="nv">choice</span><span class="o">=</span><span class="s2">&#34;</span><span class="k">$(</span> <span class="nb">printf</span> <span class="s2">&#34;%s\n&#34;</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LIVE</span><span class="p">[@]</span><span class="si">}</span><span class="s2">&#34;</span> <span class="p">|</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">LAUNCHER</span><span class="si">}</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[[</span> -n <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="c1"># get first column from selection aka stream name</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="nv">meat</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="s2">&#34;</span><span class="nv">$choice</span><span class="s2">&#34;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">NOTIFY</span><span class="si">}</span><span class="s2">&#34;</span> <span class="s2">&#34;twitch -- launching twitch.tv/</span><span class="nv">$meat</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"> streamlink twitch.tv/<span class="s2">&#34;</span><span class="nv">$meat</span><span class="s2">&#34;</span> 1080p60 --player <span class="s2">$&#34;{PLAYER}&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
|
||||
</span></span></code></pre></div><h3 id="what-it-does">What it does:</h3>
|
||||
<ul>
|
||||
<li>talk to twitch api to get auth token</li>
|
||||
<li>loop trough list of streams to check if they&rsquo;re live (using auth token)</li>
|
||||
<li>grab some info about streams that are live and append it to a list</li>
|
||||
<li>pipe said list into tofi</li>
|
||||
<li>capture user&rsquo;s choice</li>
|
||||
<li>open choice in mpv using streamlink</li>
|
||||
</ul>
|
||||
<h3 id="dependencies">Dependencies</h3>
|
||||
<ul>
|
||||
<li>curl</li>
|
||||
<li>jq</li>
|
||||
<li>tofi (would work with other launchers dmenu etc.)</li>
|
||||
<li>mpv (would work with other media players vlc etc.)</li>
|
||||
<li>dunst (would work with other notification daemons mako etc.)</li>
|
||||
</ul>
|
||||
<h3 id="positive-">Positive :)</h3>
|
||||
<ul>
|
||||
<li>no chat (you don&rsquo;t have to read the degenerates spamming LUL)</li>
|
||||
<li>you can customise the script to use your favourite desktop tools</li>
|
||||
<li>can rewind!</li>
|
||||
</ul>
|
||||
<h3 id="negative-">Negative :(</h3>
|
||||
<ul>
|
||||
<li>no chat (you might want to spam LUL)</li>
|
||||
<li>takes a second to talk to the internet so things don&rsquo;t launch immediately</li>
|
||||
<li>have to faff with getting api key - <a href="https://dev.twitch.tv/docs/api/get-started/">how to get one btw</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>Over-engineered (?) nixos blog deployment setup</title>
|
||||
<link>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</link>
|
||||
<pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<guid>http://localhost:1313/over-engineered-nixos-blog-deployment-setup/</guid>
|
||||
<description><p>As is traditional with people hosting their own blog I&rsquo;m going to do a post detailing EXACTLY how I&rsquo;m hosting my blog.
|
||||
Down to the last dirty detail.
|
||||
I have nothing better to talk about.
|
||||
Here is a diagram I edited to illustrate (credit to xkcd I think?).</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p><img src="http://localhost:1313/image/self-hosting.png" alt="self-hosting"></p>
|
||||
<p>I host my site on a hetzner vps running nixos.
|
||||
I also have a git repo where all the static files for my blog live.
|
||||
I had previously been manually rsyncing the website up to my vps from my laptop.
|
||||
|
|
@ -107,11 +212,11 @@ That&rsquo;s the directory of the git repo that the website source lives.<
|
|||
|
||||
|
||||
<item>
|
||||
<title>so you want to write a neovim plugin with lua</title>
|
||||
<link>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<title>So you want to write a neovim plugin with lua</title>
|
||||
<link>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</link>
|
||||
<pubDate>Sat, 06 Apr 2024 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<guid>http://localhost:1313/so-you-want-to-write-a-neovim-plugin-with-lua/</guid>
|
||||
<description><p>I&rsquo;ve recently been messing around with writing neovim plugins.
|
||||
When I initially got going I found it a little tricky to know how to get started.
|
||||
There&rsquo;s the <a href="https://neovim.io/doc">official neovim docs</a> which are great; but in my beginner experience exhaustive to the point of slight impenetrability.
|
||||
|
|
@ -184,11 +289,11 @@ As a little coda, this is how you can use your fancy new plugin using <a href
|
|||
|
||||
|
||||
<item>
|
||||
<title>making nix-colors talk to neovim</title>
|
||||
<link>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</link>
|
||||
<title>Making nix-colors talk to neovim</title>
|
||||
<link>http://localhost:1313/making-nix-colors-talk-to-neovim/</link>
|
||||
<pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/making-nix-colors-talk-to-neovim/</guid>
|
||||
<guid>http://localhost:1313/making-nix-colors-talk-to-neovim/</guid>
|
||||
<description><p>I recently started fiddling around with home-managerifying my neovim config.
|
||||
After moving across most of my stuff I came across the problem of how to hook things up with with <a href="https://github.com/misterio77/nix-colors">nix-colors</a> so that my neovim theme would follow color changes in home-manager.</p>
|
||||
<p>Luckily, I came across <a href="https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md">this</a> handy little plugin from the lovely <a href="https://github.com/echasnovski/mini.nvim">mini.nvim</a> suite of plugins which lets you create your own theme with your custom colors.</p>
|
||||
|
|
@ -238,11 +343,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>vanilla javascript theme toggle for simpletons</title>
|
||||
<link>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<title>Vanilla javascript theme toggle for simpletons</title>
|
||||
<link>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</link>
|
||||
<pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<guid>http://localhost:1313/vanilla-javascript-theme-toggle-for-simpletons/</guid>
|
||||
<description><p>Sometimes when I&rsquo;m trawling the internet and happen upon a particularly nice looking website, I develop css and javascript FOMO. The thing I&rsquo;ve been lusting after above all else is one of those fancy little dark theme toggle buttons. As you can probably tell from the website you&rsquo;re looking at my web dev skills are limited. As a result of this I had assumed such niceties were out of reach.</p>
|
||||
<p>Last week though I decided it was time for this to change! I would do a teeny bit of javascript. I could have nice things. This is a rundown of the very simple implementation I came up with.</p>
|
||||
<h3 id="html">HTML</h3>
|
||||
|
|
@ -325,11 +430,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>tailscale, caddy, and nixos containers - a match made in heaven</title>
|
||||
<link>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</link>
|
||||
<title>Tailscale, caddy, and nixos containers</title>
|
||||
<link>http://localhost:1313/tailscale-caddy-and-nixos-containers/</link>
|
||||
<pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/tailscale-caddy-and-nixos-containers-a-match-made-in-heaven/</guid>
|
||||
<guid>http://localhost:1313/tailscale-caddy-and-nixos-containers/</guid>
|
||||
<description><p>For a little while now I&rsquo;ve been running some services (jellyfin etc.) on an old laptop in my house. I&rsquo;m not trying to sound like a podcast ad but as a networking novice, the simplicity <a href="https://tailscale.com/">tailscale</a> brings to accessing these services remotely is very nice. Until recently though, I had been accessing my services like a heathen with http and port numbers (eg http://tailscale-ip:service-port). This works and is perfectly secure thanks to tailscale though it lacks a certain finesse. In an ideal world you&rsquo;d have a reverse proxy and set up SSL certs so your browser doesn&rsquo;t get stressed and you dont have to rememeber ip addresses and port numbers.</p>
|
||||
<p>When I initially looked at how to do this it seemed like it was above my paygrade and not worth the stress; that was until I came across <a href="https://caddy.community/t/https-in-your-vpn-caddy-now-uses-tls-certificates-from-tailscale/15380">this</a>. This works great and is as simple as advertised though there is one drawback: you can only reverse proxy one service per host. So for my usecase of the laptop with multiple services running on it I could only use the magic caddy tailscale auto-https thing for one of them.</p>
|
||||
<h3 id="what-to-do">what to do?</h3>
|
||||
|
|
@ -394,11 +499,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>learning about qtile widgets via the medium of cricket</title>
|
||||
<link>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</link>
|
||||
<title>Learning about qtile widgets with cricket</title>
|
||||
<link>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</link>
|
||||
<pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/learning-about-qtile-widgets-via-the-medium-of-cricket/</guid>
|
||||
<guid>http://localhost:1313/learning-about-qtile-widgets-with-cricket/</guid>
|
||||
<description><p>I&rsquo;m a person who has spent an unreasonable amount of time making minute changes to the appearance of my bar in qtile. Despite the very nice selection of widgets availabe by default with qtile, it was only a matter of time before I decided I wanted to experiment with making my own custom widget. Fortunately, if you can do a bit of python this is quite an approachable undertaking.</p>
|
||||
<p>The dream widget I was lacking was a little live crikcet score ticker type thing; something which would scroll along on my bar showing me the score in live cricket matches. I&rsquo;m sure this will interest very few people but I learnt some good stuff along the way.</p>
|
||||
<h3 id="hello-world">Hello World?!</h3>
|
||||
|
|
@ -506,11 +611,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>theming nirvana</title>
|
||||
<link>https://nonsense.dymc.win/theming-nirvana/</link>
|
||||
<title>Achieve peak rice with nix-colors</title>
|
||||
<link>http://localhost:1313/achieve-peak-rice-with-nix-colors/</link>
|
||||
<pubDate>Mon, 13 Mar 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/theming-nirvana/</guid>
|
||||
<guid>http://localhost:1313/achieve-peak-rice-with-nix-colors/</guid>
|
||||
<description><p>As I fall deeper and deeper down the nixos rabbit hole, I find myself becoming more and more obsessed with controlling every little thing on my computers declaratively. It starts with: &lsquo;oh this is cool I can specify which desktop environment to use in my configuration.nix&rsquo;. Next thing you know you&rsquo;ve discovered <a href="https://github.com/nix-community/home-manager">home-manager</a> and every program on every linux system you use needs to be controlled in your nix-config. Of course this slightly insane approach has its downsides; it also opens some doors though.</p>
|
||||
<p><a href="https://sr.ht/~misterio/nix-colors/">Nix-colors</a> lets you dyanmically change the theming of programs controlled in your nix config. So when you want to change the color of everything and have it match and all be pretty lol, you are able to do so with one word as opposed to poring over everything changing each individual color. For a certain type of person, this is very nice!</p>
|
||||
<h3 id="how-to-make-it-work">how to make it work</h3>
|
||||
|
|
@ -605,11 +710,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>translating docker to nix?!</title>
|
||||
<link>https://nonsense.dymc.win/translating-docker-to-nix/</link>
|
||||
<title>Translating docker to nix?!</title>
|
||||
<link>http://localhost:1313/translating-docker-to-nix/</link>
|
||||
<pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/translating-docker-to-nix/</guid>
|
||||
<guid>http://localhost:1313/translating-docker-to-nix/</guid>
|
||||
<description><p>In my opinion, there are moments when the convenience of docker and its surrounding ecosystem can&rsquo;t be beat. I&rsquo;ve been dabbling in the self hosting world and oftentimes the best maintained packaging option is a docker image. As a result of this I&rsquo;ve been playing around with the nixos approach to managing docker containers.</p>
|
||||
<h3 id="nix---docker-compose---docker-run">nix -&gt; docker compose -&gt; docker run</h3>
|
||||
<p>To illustrate how to translate a simple example from the world of docker to nix let&rsquo;s have a look at the config for my <a href="https://docs.searxng.org/">searxng</a> instance.</p>
|
||||
|
|
@ -659,11 +764,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>simple nixos config for vps static site</title>
|
||||
<link>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</link>
|
||||
<title>Simple nixos config for vps static site</title>
|
||||
<link>http://localhost:1313/simple-nixos-config-for-vps-static-site/</link>
|
||||
<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<guid>http://localhost:1313/simple-nixos-config-for-vps-static-site/</guid>
|
||||
<description><p>Setting up a little static site is something I&rsquo;ve done a few different times on a few different operating systems. It&rsquo;s a slightly fiddly task with a few disparate jobs that all need looking after: ssh, let&rsquo;s encrypt, nginx. In my opinion, it is one of the moments where consolidating all the little bits and bobs you need to setup into one common configuration is very useful.</p>
|
||||
<p>I&rsquo;m going to go through a bit of the nixos config I&rsquo;ve got for my vps.</p>
|
||||
<h3 id="ssh">SSH</h3>
|
||||
|
|
@ -719,12 +824,12 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>podcast setup for broke boys whose trash phone cant hack modern apps</title>
|
||||
<link>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</link>
|
||||
<title>Python podcast scripting</title>
|
||||
<link>http://localhost:1313/python-podcast-scripting/</link>
|
||||
<pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/podcast-setup-for-broke-boys-whose-trash-phone-cant-hack-modern-apps/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<guid>http://localhost:1313/python-podcast-scripting/</guid>
|
||||
<description><p>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 &lsquo;podcast-player-hopping&rsquo; without success for the last couple of months trying to find something which doesn&rsquo;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:</p>
|
||||
<ul>
|
||||
<li>write python script to download podcasts</li>
|
||||
<li>set up cron job on my server to run script every couple of hours</li>
|
||||
|
|
@ -811,11 +916,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>elite bread dough for lazy boys</title>
|
||||
<link>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</link>
|
||||
<title>Bread dough for lazy boys</title>
|
||||
<link>http://localhost:1313/bread-dough-for-lazy-boys/</link>
|
||||
<pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/elite-bread-dough-for-lazy-boys/</guid>
|
||||
<guid>http://localhost:1313/bread-dough-for-lazy-boys/</guid>
|
||||
<description><h3 id="ingredienti">INGREDIENTI</h3>
|
||||
<ul>
|
||||
<li>flour (ideally bread flour but if you don&rsquo;t have it, it&rsquo;s not the end of the world)</li>
|
||||
|
|
@ -857,11 +962,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>multi user qtile fiddling</title>
|
||||
<link>https://nonsense.dymc.win/multi-user-qtile-fiddling/</link>
|
||||
<title>Multi user qtile fiddling</title>
|
||||
<link>http://localhost:1313/multi-user-qtile-fiddling/</link>
|
||||
<pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/multi-user-qtile-fiddling/</guid>
|
||||
<guid>http://localhost:1313/multi-user-qtile-fiddling/</guid>
|
||||
<description><p>This post is going to detail how I solved a very particular problem I had created for myself. First, a quick description of the problem. I use home-manager on nixos to declaratively configure what happens on my computer. In the cases where home-manager does not expose sufficient configuration options for my liking (qtile for example), I instead link a configuration file from my nixos config to where it belongs in my home using <code>xdg.configFile</code>. This is what I do with my qtile <code>config.py</code>. I use qtile on my desktop and laptop but I dont want an identical setup on the two machines. I have jumped through many different slightly silly hoops in my nixos config sort of solving this problem until the other day it occured to me this could all be achieved with my python in my qtile config.</p>
|
||||
<h3 id="the-nub-of-the-problem">THE NUB OF THE PROBLEM</h3>
|
||||
<p>I basically just want the config to work out which computer it&rsquo;&rsquo;s on and then change some things accordingly. This can be achieved by getting the hostname with the socket module:</p>
|
||||
|
|
@ -937,11 +1042,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</link>
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
<link>http://localhost:1313/teeny-tiny-bash-fetch-script/</link>
|
||||
<pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/</guid>
|
||||
<guid>http://localhost:1313/teeny-tiny-bash-fetch-script/</guid>
|
||||
<description><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn&rsquo;t really try that hard with the portability). I didn&rsquo;t think much about performance; I&rsquo;m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span>
|
||||
|
|
@ -1010,18 +1115,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="nb">echo</span> -e <span class="s2">&#34;</span><span class="k">$(</span>random_color<span class="k">)</span><span class="s2"> \e[0;1;3m</span><span class="nv">$info</span><span class="s2">\e[0m</span><span class="si">${</span><span class="nv">sep</span><span class="si">}${</span><span class="nv">fetch</span><span class="p">[</span><span class="nv">$info</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="k">done</span>
|
||||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/golazo.png" alt="golazo"></p>
|
||||
<p><img src="http://localhost:1313/image/golazo.png" alt="golazo"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>get the thoughts out of your head and into a digital format with this python journal script</title>
|
||||
<link>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</link>
|
||||
<title>Get the thoughts out of your head and into a digital format with this python journalling script</title>
|
||||
<link>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</link>
|
||||
<pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journal-script/</guid>
|
||||
<guid>http://localhost:1313/get-the-thoughts-out-of-your-head-and-into-a-digital-format-with-this-python-journalling-script/</guid>
|
||||
<description><p>Since getting going with emacs I&rsquo;ve gone down the org-mode rabbit hole a little bit. In particular the very nice <a href="https://github.com/bastibe/org-journal">org-journal</a> package. It basically does what it says on the tin: maintains a journal with a selection of org files. This has been very nice for me. I have often thought about journalling but never really got up a head of steam. Somehow having an entry a keybinding away while I&rsquo;m doing something with my text editor makes it a lot more palletable.</p>
|
||||
<p>Having said all this, I am not completely converted to the church of emacs. Thus, I thoght it would be nice to write a little editor agnostic script which would emulate some of org-journal&rsquo;s features but allow you to use whatever editor you like with markdown.</p>
|
||||
<h3 id="whats-the-time">WHAT&rsquo;S THE TIME?</h3>
|
||||
|
|
@ -1081,11 +1186,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>lowkey emacs setup</title>
|
||||
<link>https://nonsense.dymc.win/lowkey-emacs-setup/</link>
|
||||
<title>Lowkey emacs setup bits and bobs</title>
|
||||
<link>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</link>
|
||||
<pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/lowkey-emacs-setup/</guid>
|
||||
<guid>http://localhost:1313/lowkey-emacs-setup-bits-and-bobs/</guid>
|
||||
<description><p>About a month ago I was a little bored and thought I&rsquo;d give emacs a go. There&rsquo;s something fun about trying out these mythical pieces of software that have been around forever; kind of like watching The Godfather for the first time. Like many extensible, super configurable programs, emacs seems kind of impenetrable at first glance. I tried doing the tutorial but kind of glazed over after a while with the endless stream of C-a C-b C-c. There&rsquo;s also the quite jarring default theme which wasn&rsquo;t vibing with the lovely screenshots I had seen on the internet. Anyway, after quite a bit of fiddling I&rsquo;ve landed on a simple little setup that I&rsquo;ve been quite enjoying. Here are a few little pointers to hopefully ease you in.</p>
|
||||
<h3 id="aesthetic-niceties">AESTHETIC NICETIES</h3>
|
||||
<p>First things first, assuming you&rsquo;re on linux emacs is configured with a file at <code>~/.emacs.d/init.el</code>. As a terrible aesthete, the first thing I was worried about was changing the theme. This can be achieved with <code>M-x load-theme</code>; if you want the setting to persist though you can add this to you init.el:</p>
|
||||
|
|
@ -1158,104 +1263,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lisp" data-lang="lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">use-package</span> <span class="nv">smart-comment</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="ss">:bind</span> <span class="p">(</span><span class="s">&#34;M-c&#34;</span> <span class="o">.</span> <span class="nv">smart-comment</span><span class="p">))</span>
|
||||
</span></span></code></pre></div><p>Here&rsquo;s a little pic of the current setup :)</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/emacs.png" alt="emacs"></p>
|
||||
<p><img src="http://localhost:1313/image/emacs.png" alt="emacs"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>setting up a lean mean hugo blogging theme</title>
|
||||
<link>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</link>
|
||||
<pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/setting-up-a-lean-mean-hugo-blogging-theme/</guid>
|
||||
<description><p>When I first started messing around with hugo, I found the whole thing slihtly mystifying. I downloaded a theme like they asked me, edited the config file to try and customise things a little and quickly broke everything. To be fair, this was mainly due to my tinkering instinct to fly to close to the sun. But anyway, the point at which I started to really appreciate the power of hugo was when I tried to make my own - admittedly less feautureful - theme. This selection of tips and tricks will assume that you&rsquo;ve just run something like <code>hugo new site lovely-new-website</code>, entered the new directory with <code>cd lovely-new-website</code> and you&rsquo;ve got a selection of mostly empty directories looking something like this.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">├── archetypes
|
||||
</span></span><span class="line"><span class="cl">│ └── default.md
|
||||
</span></span><span class="line"><span class="cl">├── config.toml
|
||||
</span></span><span class="line"><span class="cl">├── content
|
||||
</span></span><span class="line"><span class="cl">├── data
|
||||
</span></span><span class="line"><span class="cl">├── layouts
|
||||
</span></span><span class="line"><span class="cl">├── public
|
||||
</span></span><span class="line"><span class="cl">├── static
|
||||
</span></span><span class="line"><span class="cl">└── themes
|
||||
</span></span></code></pre></div><p>Our first concern will be getting a barebones theme template that can be customised to our liking. I would recommend <a href="https://github.com/ericmurphyxyz/hugo-starter-theme">this</a> guy which I used to get up and running. You could also check out <a href="https://gitlab.com/robbygozzarder/mcl">my theme</a> which I&rsquo;m using on this site that is also very simple (as you can probably see from the website lol). Once you&rsquo;ve got a theme with (I&rsquo;m using mine as an example) <code>git clone https://gitlab.com/robbygozzarder/mcl</code> and placed it in the themes directory you&rsquo;ll need to adjust your config.toml file to point it to this theme.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">theme</span><span class="p">=</span><span class="s2">&#34;mcl&#34;</span>
|
||||
</span></span></code></pre></div><p>The directory structure of your new theme will look something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">.
|
||||
</span></span><span class="line"><span class="cl">└── mcl
|
||||
</span></span><span class="line"><span class="cl"> ├── archetypes
|
||||
</span></span><span class="line"><span class="cl"> │ └── default.md
|
||||
</span></span><span class="line"><span class="cl"> ├── layouts
|
||||
</span></span><span class="line"><span class="cl"> │ ├── 404.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── _default
|
||||
</span></span><span class="line"><span class="cl"> │ │ ├── list.html
|
||||
</span></span><span class="line"><span class="cl"> │ │ └── single.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── index.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── partials
|
||||
</span></span><span class="line"><span class="cl"> │ ├── footer.html
|
||||
</span></span><span class="line"><span class="cl"> │ ├── header.html
|
||||
</span></span><span class="line"><span class="cl"> │ └── nav.html
|
||||
</span></span><span class="line"><span class="cl"> ├── README.md
|
||||
</span></span><span class="line"><span class="cl"> └── static
|
||||
</span></span><span class="line"><span class="cl"> └── css
|
||||
</span></span><span class="line"><span class="cl"> └── style.css
|
||||
</span></span></code></pre></div><p>This is where most of the magic happens:</p>
|
||||
<ul>
|
||||
<li>The default.md file in the archetypes directory dictates what template to follow when adding new post files.</li>
|
||||
<li>The layouts directory is where most of the meat is:
|
||||
<ul>
|
||||
<li>Firstly, there&rsquo;s the partials directory which contains outlines for sections which you want to be used multiple times across the site such as a footer (footer.html)</li>
|
||||
<li>Sceondly, we have _default which contains outlines for the two types of hugo pages; singles (single.html) such as this individual post page, and lists (list.html) such as the tags and posts pages on this site.</li>
|
||||
<li>Partials also contains index.html which (you guessed it!) is your home page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last but not least, there&rsquo;s static which as you can see just has the css for the site (this is all looks though - the action happens in partials).</li>
|
||||
</ul>
|
||||
<p>Now the theme is sorted the next three things you need to know anything about (imho) are the content, public, and static directories:</p>
|
||||
<ul>
|
||||
<li>Content is where you put your posts - these are just markdown files which hugo converts to html for you.</li>
|
||||
<li>Public is where hugo puts your built - ready to be served - site. You can then copy this directory to wherever your webserver is looking eg. /var/www/jdysmcl</li>
|
||||
<li>Static is where assets which you want to use with your site are kept. I basically just use it for images which I can then reference from my posts.</li>
|
||||
</ul>
|
||||
<p>Now we&rsquo;ve got the directory what&rsquo;s happening where admin out the way let&rsquo;s have a look at what some of the html files in the themes directory look like; this is the index.html for my site for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">{{ partial &#34;header.html&#34; . }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>This is mainly a place for me to document various
|
||||
</span></span><span class="line"><span class="cl">bits and bobs I&#39;ve been doing on my computers.
|
||||
</span></span><span class="line"><span class="cl">I am a noob in most things so take anything written
|
||||
</span></span><span class="line"><span class="cl">here with a pinch of salt. Lots of love :)<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ .Content }}
|
||||
</span></span><span class="line"><span class="cl">{{ range .Site.RegularPages | first 5 }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;{{ .RelPermalink }}&#34;</span><span class="p">&gt;</span>{{ .Title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Summary }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;&lt;</span><span class="nt">br</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ .Date.Format &#34;06 Jan, 2006&#34; }} |
|
||||
</span></span><span class="line"><span class="cl"> {{ .WordCount }} words |
|
||||
</span></span><span class="line"><span class="cl"> {{ .ReadingTime }} mins |
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl"> {{ range (.GetTerms &#34;tags&#34;) }}
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#39;{{ .Permalink }}&#39;</span><span class="p">&gt;</span>{{ .LinkTitle }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
|
||||
</span></span><span class="line"><span class="cl"> {{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ end }}
|
||||
</span></span><span class="line"><span class="cl">
|
||||
</span></span><span class="line"><span class="cl">{{ partial &#34;footer.html&#34; . }}
|
||||
</span></span></code></pre></div><p>In short, this plops the header and footer partials at the top and bottom of the page respectively, includes a short warning not to listen to me, and then displays my five most recent posts along with a snippet of the post and some accompanyning info: date, word count, reading time, and tags. The keen eyed among you will have noticed that this is a mish mash of normal html tags and strange stuff enclosed in double curly brackets. I&rsquo;m going to end on this cliffhanger but if you want to know more about the curly brackets check out the hugo docs <a href="https://gohugo.io/templates/introduction">here</a>.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the continuing search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates 2: Electric Boogaloo</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</link>
|
||||
<pubDate>Tue, 08 Nov 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-continuing-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates-2-electric-boogaloo/</guid>
|
||||
<description><p>Last time we worked out how to get info for all the games played by titled players in a particular month. Today, we have three objectives:</p>
|
||||
<ul>
|
||||
<li>Parse this info for the pgn (portable game notation) of each game.</li>
|
||||
|
|
@ -1278,7 +1297,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">pgn</span> <span class="ow">in</span> <span class="n">pgns</span><span class="p">:</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">pgn</span><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>Now a pgn looks something like this if it&rsquo;s just printed as a string:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/pgn.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/pgn.webp" alt="image alt text"></p>
|
||||
<p>It contains lots of very useful info but for our purposes of finding en passant checkmates, we would ideally just have a list of each move looking something like this:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">moves</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;e4&#39;</span><span class="p">,</span> <span class="s1">&#39;e5&#39;</span><span class="p">,</span> <span class="s1">&#39;Bc4&#39;</span><span class="p">,</span> <span class="s1">&#39;Nc6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qh5&#39;</span><span class="p">,</span> <span class="s1">&#39;Nf6&#39;</span><span class="p">,</span> <span class="s1">&#39;Qxf7#&#39;</span><span class="p">]</span>
|
||||
</span></span></code></pre></div><p>We don&rsquo;t need the headers, we don&rsquo;t need the result, and we don&rsquo;t really need the move numbers (these can be deduced from the list indexes). So the challenge is how to convert the pgn to a list; this is the slightly janky solution I came up wtih.</p>
|
||||
|
|
@ -1306,11 +1325,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>chess.com api and the search for en passant checkmate</title>
|
||||
<link>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</link>
|
||||
<title>The search for en passant checkmates</title>
|
||||
<link>http://localhost:1313/the-search-for-en-passant-checkmates/</link>
|
||||
<pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/chess.com-api-and-the-search-for-en-passant-checkmate/</guid>
|
||||
<guid>http://localhost:1313/the-search-for-en-passant-checkmates/</guid>
|
||||
<description><p>The chess.com API gives you access to a crazy amount of data on games played on the site. Armed with the knowledge that this data was at my fingertips, I set out to do what any sane person would do: find en passant checkmates. For those not in the know, en passant check mate is kind of the king of moves in chess meme circles. So some sort of python script that identified en passant check mates that occured on the site would be of great value to me.</p>
|
||||
<p>First things first, I would need a method of grabbing lots of games from the api. This would be achieved by looking at players on the site and searching their game archives. As I couldn&rsquo;t think of any obvious way to get completely random players on the site, I used the API&rsquo;s lists of all titled players (GM, IM, WIM, etc.) on the site. This is what I came up with -&gt;</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">get_archive_urls</span><span class="p">(</span><span class="n">titled_urls</span><span class="p">):</span>
|
||||
|
|
@ -1345,18 +1364,18 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="s1">&#39;https://api.chess.com/pub/titled/WGM&#39;</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="p">]))</span>
|
||||
</span></span></code></pre></div><p>We get a very long list of json objects (is that the right phrase? um). Each corresponding to one of games played by GMs and WGMs on chess.com during May of 2022. Come back next time to see what we can do with this very long list. Here&rsquo;s a taster of what the list looks like printed to a terminal - lots of possiblities.</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/output.webp" alt="image alt text"></p>
|
||||
<p><img src="http://localhost:1313/image/output.webp" alt="image alt text"></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>declarative firefox config with home-manager on nixos</title>
|
||||
<link>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<title>Declarative firefox config with home-manager on nixos</title>
|
||||
<link>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</link>
|
||||
<pubDate>Sun, 02 Oct 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<guid>http://localhost:1313/declarative-firefox-config-with-home-manager-on-nixos/</guid>
|
||||
<description><p>As a man who finds himself reinstalling his OS more than is probably sensible, any opportunity to minimise the post install admin of sorting out all your settings is an attractive one. With that in mind lets take a look at some of the firefox (my current browser of choice) configuration options avilable to you through home-manager. This assumes you have some sort of home-manager setup working. If you do not I found <a href="https://github.com/misterio77/nix-starter-configs">this</a> friendly githubber&rsquo;s templates to be very helpful.</p>
|
||||
<p>First of all you&rsquo;ll need to enable firefox with <code>programs.firefox.enable = true;</code></p>
|
||||
<h3 id="extensions">EXTENSIONS</h3>
|
||||
|
|
@ -1418,11 +1437,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<title>Upgrade your qtile setup with a cute dropdown terminal</title>
|
||||
<link>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</link>
|
||||
<pubDate>Fri, 23 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<guid>http://localhost:1313/upgrade-your-qtile-setup-with-a-cute-dropdown-terminal/</guid>
|
||||
<description><p>I didn&rsquo;t know you could do this until recently, very fun and playful little feature. How you want to do it will depend slightly on how you have your groups set up but I start with importing the relevant libraries and defining an empty list.</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">libqtile.config</span> <span class="kn">import</span> <span class="n">Dropdown</span><span class="p">,</span> <span class="n">Scratchpad</span>
|
||||
</span></span><span class="line"><span class="cl">
|
||||
|
|
@ -1439,7 +1458,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">),</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives you a terminal (kitty in this case) with a little tranparency. By default, it will pop up with this size:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown.webp" alt="alt"></p>
|
||||
<p>Though this can easily be altered with the x, y, height, and width keys:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">ScratchPad</span><span class="p">(</span><span class="s2">&#34;scratchpad&#34;</span><span class="p">,</span> <span class="p">[</span>
|
||||
|
|
@ -1455,7 +1474,7 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
</span></span><span class="line"><span class="cl"> <span class="p">])</span>
|
||||
</span></span><span class="line"><span class="cl"><span class="p">)</span>
|
||||
</span></span></code></pre></div><p>This gives us a little boxy guy in the top left corner:</p>
|
||||
<p><img src="https://nonsense.dymc.win/image/dropdown2.webp" alt="alt"></p>
|
||||
<p><img src="http://localhost:1313/image/dropdown2.webp" alt="alt"></p>
|
||||
<p>We also have the option to set keybindings to toggle the appearance of the window. I&rsquo;ve got this in my config.py now:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="n">Key</span><span class="p">([</span><span class="n">m</span><span class="p">,</span> <span class="s2">&#34;shift&#34;</span><span class="p">],</span> <span class="s2">&#34;Return&#34;</span><span class="p">,</span>
|
||||
|
|
@ -1470,11 +1489,11 @@ After moving across most of my stuff I came across the problem of how to hook th
|
|||
|
||||
|
||||
<item>
|
||||
<title>rudimentary local scrobbling with bash</title>
|
||||
<link>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<title>Rudimentary local scrobbling with bash</title>
|
||||
<link>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</link>
|
||||
<pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://nonsense.dymc.win/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<guid>http://localhost:1313/rudimentary-local-scrobbling-with-bash/</guid>
|
||||
<description><p>There are lots of music players on linux. I have used lots of them, I quite like some of them. But for some reason I decided I wanted more. With this in mind, over the past few months I have been constructing a sprawling ecosystem of bash scripts all geared towards delivering a customised listening experience tailored perfectly to my every need. In short, the setup uses a simple dmenu file manager to browse my local files and mpv to play them. Today I&rsquo;ll be talking specifically about my setup for recording the albums I&rsquo;ve been listening to.</p>
|
||||
<h3 id="lets-get-down-to-business">LET&rsquo;S GET DOWN TO BUSINESS</h3>
|
||||
<p>Whenever I select a file to be played with my script I am effectively selecting a path to a file or a path to a directory with files in it which is then fed to mpv. For example, if I&rsquo;m playing the classic album Lemonade by Beyonce it would look like this:</p>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue