Skip to content

Instantly share code, notes, and snippets.

View CornerSyrup's full-sized avatar
:electron:
Monadic

Klein CornerSyrup

:electron:
Monadic
View GitHub Profile
@CornerSyrup
CornerSyrup / git-prune-unreachable.sh
Created January 9, 2026 14:52
Git prune unreachable objects (only in reflog)
git reflog expire --expire=now --all
git gc --prune=now
@CornerSyrup
CornerSyrup / clean-reflog.sh
Created October 12, 2025 13:29
Housecleaning after many rebase
git reflog expire --expire-unreachable=now --all
git gc --prune=now
@CornerSyrup
CornerSyrup / Enigma.ts
Created September 14, 2025 08:37
An implementation of Enigma in TypeScript with my weakest programming skill, AI co-autor
const base = 97;
const ALPHABET_LENGTH = 26;
const Rotor =
(config: number) =>
(plain: string): string => {
if (plain < "a" || plain > "z") {
return plain;
}
@CornerSyrup
CornerSyrup / BOM.csv
Last active November 29, 2024 12:20
6 x 6 Barebone UV Torch
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 2.
ID Name Designator Footprint Quantity Manufacturer Part Manufacturer Supplier Supplier Part Price Pins 3DModel Contributor JLCPCB Part Class link
"1" "LED-SMD_XL-3535UV1SB12P3" "LED01,LED2,LED3,LED4,LED5,LED6,LED7,LED8,LED9,LED10,LED11,LED12,LED13,LED14,LED15,LED16,LED17,LED18,LED19,LED20,LED21,LED22,LED23,LED24,LED25,LED26,LED27,LED28,LED29,LED30,LED31,LED32,LED33,LED34,LED35,LED36" "LED-SMD_XL-3535UV1SB12P3" "36" "XL-3535UV1SB12P2" "XINGLIGHT(成兴光)" "LCSC" "C962562" "0.786" "3" "LED-SMD_L3.5-W3.1-H1.5-XL-3535UV1SB12P3" "LCSC" "Extended Part" "https://lcsc.com/eda_search?q=C962562&%26type=1&ref=editor"
@CornerSyrup
CornerSyrup / predicate.test.ts
Created October 8, 2024 11:33
Trying to write something similar to fp-ts and implementing custom instance
import { describe, expect, it, test } from "bun:test";
import { allOf, allOfM, doubleLength, isWord } from ".";
it.each([["hello", 10]])("should double the length (%s)", (word, exp) => {
expect(doubleLength(word)).toBe(exp);
});
describe.each([
[[true, false, true], false],
[[true, true, true], true],
@CornerSyrup
CornerSyrup / mdn.html
Last active May 10, 2024 08:13
Showing how metatags are being used in modern webpages with a browser and crawlers. (omitting common tags, e.g. title, meta-charset)
<!-- https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel -->
<meta name="robots" content="index, follow">
<meta name="description" content="The rel attribute defines the relationship between a linked resource and the current document. Valid on &lt;link&gt;, &lt;a&gt;, &lt;area&gt;, and &lt;form&gt;, the supported values depend on the element on which the attribute is found."/>
<meta property="og:url" content="https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel"/>
<meta property="og:title" content="HTML attribute: rel - HTML: HyperText Markup Language | MDN"/>
<meta property="og:type" content="website"/>
<meta property="og:locale" content="en_US"/>
<meta property="og:description" content="The rel attribute defines the relationship between a linked resource and the current document. Valid on &lt;link&gt;, &lt;a&gt;, &lt;area&gt;, and &lt;form&gt;, the supported values depend on the element on which the attribute is found."/>
<meta property="og:image" content="https://developer.mozilla.
@CornerSyrup
CornerSyrup / metrics.js
Last active October 7, 2023 13:25
Serve PM2 metrics over http on Node.js
const http = require("http");
const pm2 = require("pm2");
http
.createServer(async (req, res) => {
res.writeHead(200, { "Content-Type": "application/json" });
metrics = new Promise((res) => {
pm2.list((err, list) => {
res(
list.map((proc) => ({
@CornerSyrup
CornerSyrup / get-kernel-version
Created August 24, 2023 12:48
Useful linux commands
$ cat /proc/version
# Linux version 4.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
@CornerSyrup
CornerSyrup / youtube-dl.md
Created August 20, 2023 14:34
common options for youtube-dl

youtube-dl

youtube-dl.exe -o "%(channel_id)s/%(title)s.%(ext)s" --external-downloader aria2c -f bestvideo[ext=mp4],bestaudio[ext=m4a] --add-metadata --xattrs --write-thumbnail --embed-thumbnail https://www.youtube.com/watch?v=dQw4w9WgXcQ

List video format

Flag: -F, --list-formats

@CornerSyrup
CornerSyrup / main.hs
Last active August 14, 2023 08:23
code used in https://youtu.be/BovTQeDK7XI by Tsoding. Great example of monoid.
module Main where
import Data.Char
import Data.Monoid
import Data.Foldable
isBraille :: Char -> Bool
isBraille = undefined
isEmoji :: Char -> Bool