Skip to content

Instantly share code, notes, and snippets.

View chesterbr's full-sized avatar

Carlos Duarte Do Nascimento (Chester) chesterbr

View GitHub Profile
@chesterbr
chesterbr / audit_flickr.rb
Created October 3, 2026 21:10
chesterbr.github.io: Flickr reference audit — scans _posts, classifies/live-checks Flickr images, photo-page links and album/set links
#!/usr/bin/env ruby
# frozen_string_literal: true
# Surveys Flickr references across post sources (_posts/*.md) to size the
# de-Flickr'ing effort: which posts embed/link Flickr photos, how many, whether
# they're chesterbr's own, whether there's an album/set link, and which URLs are
# dead. Reads source Markdown (not _site) so results map to the files to edit.
# Read-only: prints a decision table and writes tmp/flickr_audit.csv; fixes nothing.
#
# Usage:
@chesterbr
chesterbr / deflickr_inlines.rb
Created October 3, 2026 21:10
chesterbr.github.io: de-Flickr inline images — plan/apply re-hosting of hotlinked staticflickr <img> from Apple Photos (via osxphotos) into /img
#!/usr/bin/env ruby
# frozen_string_literal: true
# De-Flickr inline images: re-host every hotlinked staticflickr <img> in the
# posts from the local Apple Photos library into /img/YYYY/MM/, and rewrite the
# posts to serve the local copy (click opens the full-size file, lazy-loaded).
# Posts that already serve photos from /wp-content/ are untouched; album/set
# links and dead photo-page links are out of scope (handled separately).
#
# TWO phases so nothing is written until you have reviewed the matches:
@chesterbr
chesterbr / import_disqus.mjs
Created February 14, 2024 00:55
A script that imports Disqus posts into a format usable by Staticman
// import_disqus.mjs
// =================
//
// Converts Disqus XML export to a format compatible with Staticman (https://staticman.net/)
//
// Requires Node.js and the following packages:
//
// npm install xml2js crypto-js strip-indent
//
// (c) 2024 Carlos Duarte Do Nascimento (https://chester.me)
@chesterbr
chesterbr / compress_words.rb
Created February 1, 2022 05:58
First attempt to fit the Wordle word list in an Atari VCS non-bankswitched ROM
#!/bin/ruby
# I'm trying to figure out whether we could fit the Wordle dictionary in a 4K ROM with enough space
# to squeeze an non-bankswitched Atari 2600 game port.
#
# As a first study, this Ruby script compresses a list of word in a way that a simple CPU (6507)
# could decompress on-the-fly, even after some Huffman coding is applied. Not worried with the
# Huffman coding itself; just checking https://resources.nerdfirst.net/huffman.html; previous art of
# Huffman decompression (if we use it) - can be found at http://forum.6502.org/viewtopic.php?t=4642.
#
@chesterbr
chesterbr / dump.txt
Created June 26, 2021 03:19
Formatted dump of breadboard Atari VCS CPU + cart + TIA running Hello World
00 00 00 F0 F0 F0
A9 A9 02 A9 02 02
85 85 85 00 00 00
40 02 02
85 85 85 02 02 02
42 02 02
85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85
85 85 85 02 02 02
42 02 02
85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85
@chesterbr
chesterbr / test.txt
Last active March 11, 2021 23:39
test
CHANGED
@chesterbr
chesterbr / washing_machine_alarm.ino
Created December 23, 2017 02:42
Washing Machine Alarm with Arduino and ADXL-345 acceleration sensor
// washing_machine_alarm.ino
//
// Copyright by Carlos Duarte Do Nascimento, 2017
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
// More info: https://chester.me/archives/2017/12/motion-sensing-arduino-based-washing-machine-alarm/
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>
#include <LowPower.h>
@chesterbr
chesterbr / Insignia_RMC-SB314.lircd.conf
Created December 12, 2017 23:47
Insignia RMB-SB314 remote control codes for LIRC (for Insignia NS-SB314 Sound Bar System)
# Please take the time to finish this file as described in
# https://sourceforge.net/p/lirc-remotes/wiki/Checklist/
# and make it available to others by sending it to
# <lirc@bartelmus.de>
#
# This config file was automatically generated
# using lirc-0.9.4c(default) on Thu Dec 7 01:07:17 2017
# Command line used: --disable-namespace -f -d /dev/lirc0 /home/chester/lircd.conf
# Kernel version (uname -r): 4.9.59+
#
@chesterbr
chesterbr / Sharp_LCDTV-845-039-40B0.lircd.conf
Created December 12, 2017 23:45
Sharp LCDTV 845-039-40B0 TV Remote Control codes for LIRC (for Sharp LC-40LE431U TV)
# Please take the time to finish this file as described in
# https://sourceforge.net/p/lirc-remotes/wiki/Checklist/
# and make it available to others by sending it to
# <lirc@bartelmus.de>
#
# This config file was automatically generated
# using lirc-0.9.4c(default) on Thu Dec 7 01:17:39 2017
# Command line used: --disable-namespace -d /dev/lirc0 /home/chester/lircd.conf
# Kernel version (uname -r): 4.9.59+
#
@chesterbr
chesterbr / 6507_clock_and_monitor.c
Last active September 9, 2017 16:16
10Hz clock pulse generator / 13-bit monitor (for 6507 CPU)
// Turns an Arduino into a 10Hz clock generator and a monitor for a 13-bit address bus
//
// Based on David Barton's clock generator/monitor in http://www.plingboot.com/2015/10/homebrew-6502-part-2/
// (MIT License; full license information on footer)
// Pulse pin 13
#define CLOCK 13
// Read pins 0-12 as a 13 bit value from 6507's address bus
#define ADDRA 0
#define ADDRB 1