Skip to content

Instantly share code, notes, and snippets.

View CodeMan99's full-sized avatar

Cody A. Taylor CodeMan99

View GitHub Profile
@CodeMan99
CodeMan99 / log-request.js
Last active November 19, 2024 19:39
JSON request debugging server
const http = require('http');
const server = http.createServer(async function(req, res) {
const buffers = [];
for await (const data of req) {
buffers.push(data);
}
let body = null;
if (buffers.length > 0) {
@CodeMan99
CodeMan99 / devcontainer.json
Created February 20, 2025 05:29
Kotlin using VS Code via a Devcontainer
{
"name": "Debian",
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"customizations": {
"vscode": {
"extensions": [
"fwcd.kotlin",
"vscjava.vscode-java-pack"
]
}
@CodeMan99
CodeMan99 / watch.sh
Created March 18, 2025 12:57
Bash implementation of `watch`
#!/usr/bin/env bash
#
# Usage: watch.sh "<command>" [interval]
# https://stackoverflow.com/questions/9574089/os-x-bash-watch-command
pid=$$
command="$1"
# default interval of 2 seconds
interval="${2:-2}"
import sys
def columns(end):
char_a = ord('A')
alpha_iter = lambda: (chr(c) for c in range(char_a, char_a + 26))
p = [alpha_iter()]
v = [None]
@CodeMan99
CodeMan99 / columns.php
Last active June 25, 2025 11:50
Excel columns letters using LazyCollection
<?php
use Illuminate\Support\LazyCollection;
$columns = LazyCollection::make(function() {
yield $i = 1 => $c = 'A';
while (true) {
yield ++$i => $c = str_increment($c);
}
@CodeMan99
CodeMan99 / board.lfe
Created July 2, 2025 04:49
F# - Conway's Game of Life
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000010000000000000000000000000000000000000
0000000000000000000000001010000000000000000000000000000000000000
0000000000000011000000110000000000001100000000000000000000000000
0000000000000100010000110000000000001100000000000000000000000000
0011000000001000001000110000000000000000000000000000000000000000
0011000000001000101100001010000000000000000000000000000000000000
0000000000001000001000000010000000000000000000000000000000000000
0000000000000100010000000000000000000000000000000000000000000000
0000000000000011000000000000000000000000000000000000000000000000
@CodeMan99
CodeMan99 / life.py
Last active July 4, 2025 00:36
Conway's Game of Life - functional python from https://youtu.be/o9pEzgHorH0?feature=shared&t=1040
import sys
from itertools import chain
from time import sleep
def neighbors(point):
x, y = point
yield x + 1, y
yield x - 1, y