Skip to content

Instantly share code, notes, and snippets.

@cmdr2
cmdr2 / focus-column-image-popup-conditional-invert.js
Last active August 11, 2026 06:32
focus-column-image-popup-conditional-invert.js
javascript:(function(){var d=document;var elms=d.querySelectorAll('style,link[rel="stylesheet"]');for(var i=0;i<elms.length;i++){elms[i].parentNode.removeChild(elms[i]);}var s=d.createElement('style');s.innerHTML='* { background: #181a1b !important; color: rgb(232, 230, 227) !important; font-family: monospace !important; font-size: 12pt !important; line-height: 1.4 !important; border: none !important; } body { column-count: 3 !important; column-gap: 40px !important; max-width: 100% !important; margin: 0 auto !important; padding: 40px !important; h1, h2, h3 { column-span: all !important; display: inline; } } a { color: rgb(232, 230, 227) !important; text-decoration: underline !important; } a:visited { color: rgb(232, 230, 227) !important; } img, svg, canvas { max-width: 100% !important; height: auto !important; cursor: pointer !important; opacity: 0.6 !important; } .img-container-wrapper { position: relative !important; display: inline-block !important; max-width: 100% !important; background: transparent !impo
@cmdr2
cmdr2 / focus-columns-image-popup.js
Last active August 6, 2026 10:23
focus-columns-image-popup.js
javascript:(function(){var d=document;var elms=d.querySelectorAll('style,link[rel="stylesheet"]');for(var i=0;i<elms.length;i++){elms[i].parentNode.removeChild(elms[i]);}var s=d.createElement('style');s.innerHTML='* { background: #181a1b !important; color: rgb(232, 230, 227) !important; font-family: monospace !important; font-size: 12pt !important; line-height: 1.4 !important; border: none !important; } body { column-count: 3 !important; column-gap: 40px !important; max-width: 100% !important; margin: 0 auto !important; padding: 40px !important; h1, h2, h3 { column-span: all !important; display: inline; } } a { color: rgb(232, 230, 227) !important; text-decoration: underline !important; } a:visited { color: rgb(232, 230, 227) !important; } img, svg, canvas { filter: invert(1) hue-rotate(180deg) opacity(0.6) !important; max-width: 100% !important; height: auto !important; cursor: pointer !important; }';d.head.appendChild(s);d.querySelectorAll('img, svg, canvas').forEach(function(el){el.onclick=function(e){e.st
@cmdr2
cmdr2 / focus-columns.js
Created July 28, 2026 06:32
Focused reader bookmarklet - columns
javascript:(function(){var d=document;var elms=d.querySelectorAll('style,link[rel="stylesheet"]');for(var i=0;i<elms.length;i++){elms[i].parentNode.removeChild(elms[i]);}var s=d.createElement('style');s.innerHTML='* { background: #181a1b !important; color: rgb(232, 230, 227) !important; font-family: monospace !important; font-size: 12pt !important; line-height: 1.4 !important; border: none !important; } body { column-width: 550px !important; column-gap: 40px !important; max-width: 100% !important; margin: 0 auto !important; padding: 40px !important; h1, h2, h3 { column-span: all !important; display: inline; } } a { color: rgb(232, 230, 227) !important; text-decoration: underline !important; } a:visited { color: rgb(232, 230, 227) !important; } img, svg, canvas { filter: invert(1) hue-rotate(180deg) opacity(0.6) !important; max-width: 100% !important; height: auto !important; }';d.head.appendChild(s);})();
@cmdr2
cmdr2 / focus.js
Created July 28, 2026 05:57
Focused reader bookmarklet
javascript:(function(){var d=document;var elms=d.querySelectorAll('style,link[rel="stylesheet"]');for(var i=0;i<elms.length;i++){elms[i].parentNode.removeChild(elms[i]);}var s=d.createElement('style');s.innerHTML='* { background: #181a1b !important; color: rgb(232, 230, 227) !important; font-family: monospace !important; font-size: 12pt !important; line-height: 1.2 !important; border: none !important; } a { color: rgb(232, 230, 227) !important; text-decoration: underline !important; } a:visited { color: rgb(232, 230, 227) !important; } img, svg, canvas { filter: invert(1) hue-rotate(180deg) opacity(0.6) !important; }';d.head.appendChild(s);})();
@cmdr2
cmdr2 / sqldiff.py
Created September 19, 2025 09:22
Simple SQL diff program
import sys
import sqlite3
if len(sys.argv) < 3:
print("Usage: python sqldiff.py <file1> <file2>")
exit()
db1 = sys.argv[1]
db2 = sys.argv[2]
@cmdr2
cmdr2 / github-deploy-setup
Last active September 4, 2025 16:50
DEPRECATED - use https://github.com/cmdr2/github-actions-wizard instead! Utility script to easily setup a GitHub deploy action in a repository for pushing to S3 or Lambda. Creates the required IAM roles automatically.
#!/usr/bin/env python3
# !!!!!!!!!!!!!!!!!!!!!!! DEPRECATED - use https://github.com/cmdr2/github-actions-wizard instead!
import os
import subprocess
import json
import time
def run_capture(cmd):
@cmdr2
cmdr2 / foundational-web-components-demo.html
Created July 29, 2025 10:11
Demo of foundational tags like img, b, button implemented using Web Components
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Custom Elements Demo</title>
</head>
<body>
<custom-b>Hello, bold world!</custom-b>
<br><br>
@cmdr2
cmdr2 / overflow_clipping_test.py
Created July 24, 2025 09:34
Uses a fragment shader to discard pixels outside the clipping volume (specified by a transform matrix, and local size)
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
VERT_SHADER = """
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelMatrix;
in vec2 texCoord;
in vec3 position;
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
VERT_SHADER = """
uniform mat4 ModelViewProjectionMatrix;
in vec2 texCoord;
in vec3 position;
out vec3 pos;
// can run on https://thebookofshaders.com/edit.php
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0);