Skip to content

Instantly share code, notes, and snippets.

@tlhakhan
tlhakhan / multi_color_knights.py
Created May 26, 2026 00:43
Implementation of Multi Color Knights by Claude
"""
Multi-player generalization of the Red & Black Knights construction.
Same square spiral, same "smallest unoccupied cell not threatened by a
hostile piece" rule, but the number of players, the move set of each
player's piece, and the directed threat relation between players are all
configurable. The two-knight case (OEIS A392177) is recovered with two
knight players that mutually threaten each other.
See https://jonka364.github.io/stendhal/stendhal.html for Karlsson's gallery
@tlhakhan
tlhakhan / red_black_knights.py
Last active May 26, 2026 00:45
Implementation of Red & Black Knights - Numberphile by Claude
"""
Red & Black Knights on a square spiral.
Construction (OEIS A392177 / A392178 / A395357, Numberphile 2026-05-12):
Number the cells of an infinite square spiral starting at 0 in the center,
moving right first and then counterclockwise (OEIS A274641 layout).
Black and Red take turns, Black first.
- On Black's turn, place a knight on the smallest unoccupied cell
that is NOT attacked by an existing Red knight.
@tlhakhan
tlhakhan / openssl-etcd-tls-cert-setup.md
Created May 22, 2026 14:00
OpenSSL command examples to generate certificates for my etcd cluster

etcd TLS Certificates with OpenSSL

Full walkthrough for generating a CA, server, peer, and client certificates for etcd using the modern genpkey/pkey subcommands and .ext config files.


Overview

| Role | File prefix | EKU | SANs |

@tlhakhan
tlhakhan / remove-hashicorp.sh
Created May 14, 2026 18:42
A helper script to remove hashicorp tools from existing machines
#!/usr/bin/env bash
set -euo pipefail
# Remove HashiCorp packages
apt-get remove -y terraform packer vault 2>/dev/null || true
# Remove terraform-docs binary
rm -f /usr/local/bin/terraform-docs
# Remove HashiCorp APT repository
#!/bin/bash
# for apt cache
mkdir -p /opt/local/apt-cache
cat << 'EOF' > /etc/apt/sources.list.d/cache.list
deb [trusted=yes] http://console-1.local:3142 noble/
EOF
apt-get update
@tlhakhan
tlhakhan / vm-builder-ca.crt
Last active April 15, 2026 21:16
vm-builder-ca
-----BEGIN CERTIFICATE-----
MIIBVDCB+6ADAgECAhQQRf9xSyW6IGgvrJ3j4lLJVsv2NzAKBggqhkjOPQQDAjAY
MRYwFAYDVQQDDA12bS1idWlsZGVyLWNhMB4XDTI2MDQxNTIxMTM1NVoXDTM2MDQx
MjIxMTM1NVowGDEWMBQGA1UEAwwNdm0tYnVpbGRlci1jYTBZMBMGByqGSM49AgEG
CCqGSM49AwEHA0IABMeg4nhzRc659GuJnE8QPZrCSBChHuDkAJCz+sjIli7DDbzS
9pBql7sSzWj7Ao0RCf077ze4q5YH+6djCHDwmJyjIzAhMA8GA1UdEwEB/wQFMAMB
Af8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMCA0gAMEUCIQCMD+/vQyGgaPAX
J2pqPdM+LYka6FGkLadnR8qrWgh7/gIgeKWRs/rBzHf+KS2HaKEgeBVVE3kPnmuM
cGGbH8Kb5Lc=
-----END CERTIFICATE-----
@tlhakhan
tlhakhan / tenzins_keymap.json
Last active April 13, 2026 12:47
A keymap for my inland/mk47 keyboards
{
"version": 1,
"notes": "",
"documentation": "tenzins keymap",
"keyboard": "inland/mk47",
"keymap": "tenzins_keymap",
"layout": "LAYOUT_planck_mit",
"layers": [
[
"KC_TAB",

Absolutely — great job finishing Problem Solving (2nd Edition) by S. Ian Robertson. It’s a dense book but one of the most practical introductions to how humans actually solve problems, why we sometimes fail, and how to deliberately improve.

Below is a structured refresher plus concrete, actionable takeaways tuned for your personal learning style (you tend to like systems, breakdowns, templates, right-brain/left-brain alternation, and deep skill-building).


🧠 High-Level Summary of the Book

Robertson’s core premise:

@tlhakhan
tlhakhan / microsoft-vscode-issues-175586.md
Last active August 26, 2025 14:43
Cannot scroll through terminal. Scroll wheel instead will scroll through command history #175586

Cannot scroll through terminal. Scroll wheel instead will scroll through command history #175586

Original post: microsoft/vscode#175586

I also ran into a similar issue where, when I scroll on my terminal window, it doesn't scroll the entire output, but scrolls through my command history, its very annoying. I found the above post #175586, it ended unsolved.

Here is my fix, and it was related to setting I had done earlier but forgotten about:

  • terminal.integrated.scrollback and setting it to 0, thinking that this would set my output buffer to be unlimited, but it really sets my scrollback buffer/window size to 0.
  • FIX: Set terminal.integrated.scrollback to some large number and re-open the terminal, instead of 0.
@tlhakhan
tlhakhan / machine-setup.sh
Last active July 30, 2025 15:51
machine-setup.sh
#!/bin/bash
echo "Installing packages"
sudo apt-get install -y vim git tmux mosh unzip tree curl avahi-daemon wakeonlan python3-venv
echo "Setting up gitconfig"
test -e ~/.gitconfig || cat <<EOF > ~/.gitconfig
[user]
name = Tenzin Lhakhang
email = 2402007+tlhakhan@users.noreply.github.com