Skip to content

Instantly share code, notes, and snippets.

View yetanotherchris's full-sized avatar
馃攺
;每每每每rules

Chris S. yetanotherchris

馃攺
;每每每每rules
View GitHub Profile
@yetanotherchris
yetanotherchris / go-template-parser.md
Last active June 12, 2025 20:25
Claude's response for improvements to a C# implementation of Go's text templates

Go Text/Template Parser Implementation with ANTLR

Implement a basic Go text/template parser using ANTLR that supports core template functionality. The parser should handle variable interpolation, conditional statements, and loops while maintaining compatibility with Go's template syntax.

Core Requirements

1. Variable Interpolation

  • Support {{ .Field }} syntax for accessing struct fields
  • Support nested field access: {{ .User.Name }}
  • Support array/slice indexing: {{ .Items[0] }}
@yetanotherchris
yetanotherchris / ubuntu-and-mint-on-chromebook.md
Last active April 18, 2025 10:39
Installed Mint or Ubuntu on ChromeBook

From my experience, a Chromebook is so locked down to protect your account, it's not worth trying to boot another Linux version onto it. You can run a Linux image inside its VM, although the performance is a bit poor:

  1. Install Penguin on the machine (Linux) with 100gb
  2. sudo apt update
  3. Install quickemu https://github.com/quickemu-project/quickemu (download the .deb file)
  4. Mint worked best for me: quickget linuxmint 22 cinnamon
  5. Edit the conf file to increase the disk space to 30-40gb, higher resolution
  6. Follow the terminal output instructions for running it, e.g. quickemu --vm ...
  7. On Mint itself, you likely have to download deb files for Chrome, Visual Studio Code.
@yetanotherchris
yetanotherchris / convert-epub-to-markdown-to-html-to-pdf.ps1
Last active April 17, 2025 22:08
Convert ePub to Markdown then to HTML then to PDF (in Powershell)
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]$FileName
)
# This script converts an ePub to Markdown, removing formatting that something like 11reader can't read.
# Then it converts the Markdown to HTML, and finally the HTML to PDF, if you want to retain the images.
# Needs Chrome and NodeJS installed, and Windows.
@yetanotherchris
yetanotherchris / chat-html-part.html
Last active March 26, 2025 20:52
ChatGPT export (HTML) sort and add a table of contents
<body>
<ul id="titles"></ul>
<div id="root"></div>
</body>
@yetanotherchris
yetanotherchris / valve-trust-score.md
Last active October 27, 2024 20:40
Thoughts on Valve's Trust Score System
@yetanotherchris
yetanotherchris / youtube.py
Created September 9, 2024 14:28
Retrieve Youtube video title, author, duration (as Markdown)
import requests
import isodate # To parse ISO 8601 durations
# Create an API key in Google Cloud: API/Service Details/Credentials
API_KEY = 'mykey'
VIDEO_IDS = [
'KZSD3lauzDo', 'puddZhRgRNI', 'YJTjtoKGCYo', '-PjtJeMvsFI', 'KZSD3lauzDo',
'puddZhRgRNI', 'YJTjtoKGCYo', '-PjtJeMvsFI', 'KZSD3lauzDo', 'puddZhRgRNI',
'YJTjtoKGCYo', '-PjtJeMvsFI'
]
@yetanotherchris
yetanotherchris / firefox-bookmarks-jq.sh
Created August 21, 2024 17:07
List all Firefox bookmark titles and urls from JSON Export file, using JQ
# Tested on Ubuntu, use 'apt-get install jq'
cat ./bookmarks.json | jq '.. | select(.type?=="text/x-moz-place") | "\(.title?), \(.uri)"?'
cat ./bookmarks.json | jq -r '.. | select(.type?=="text/x-moz-place") | "- [\(.title?)](\(.uri?))"' > uris.md
# The second prints a markdown file using the title and uri
@yetanotherchris
yetanotherchris / http-load-test.ps1
Created March 30, 2022 08:34
Powershell HTTP "load testing" (about 3-5 RPS)
while ($true) { $r = wget -uri "http://somesite.com?q=1" -headers @{"Accept-Tenant"="Nz"}; echo $r.Content }
@yetanotherchris
yetanotherchris / monitor-speed.ps1
Created March 14, 2022 15:08
Monitor internet speed test in Powershell
# choco install -y jq
# npm install --global fast-cli
while ($true)
{
$now = date;
$dateRow = $now.ToString("dd-MM-yyyy HH:mm");
$dl = fast -u --json | jq '.downloadSpeed';
echo "$dateRow, $dl" >> data.txt;