Skip to content

Instantly share code, notes, and snippets.

View nicholaswmin's full-sized avatar
💭
I may be slow to respond.

Nicholas Kyriakides nicholaswmin

💭
I may be slow to respond.
View GitHub Profile
@nicholaswmin
nicholaswmin / vouch.zsh
Last active May 23, 2025 15:59
Creates and automatically trusts self-signed SSL on macOS
#!/usr/bin/env zsh
autoload -U colors && colors
# Check for correct shell
if [ -z "$ZSH_VERSION" ]; then
echo "Error: This script must be run with zsh, not sh or bash"
echo "Please run with: zsh ./vouch.zsh install"
exit 1
fi
@nicholaswmin
nicholaswmin / zed-extsync.zsh
Last active May 23, 2025 08:00
declaratively list all installed zed.dev extensions in settings.json
#!/usr/bin/env zsh
# ext-sync.zsh
#
# Authors: 2025 - nicholaswmin - MIT
#
# Declaratively lists all installed zed.dev extensions
# in `settings.json` under `auto_install_extensions`
# - Run once before backing up dotfiles.
# - https://zed.dev/docs/configuring-zed#auto-install-extensions
#
@nicholaswmin
nicholaswmin / dit.sh
Created May 9, 2025 10:38
git-based dotfiles management
#!/usr/bin/env zsh
# a git-based, no-tools dotfiles manager
# authors: @nicholaswmin, The MIT License
set -e
# TODO:
# - [ ] think about Spotlight filetype exclusion
# - [ ] consider ohmyzsh
# - [ ] automate git clone of work projects
@nicholaswmin
nicholaswmin / decimators.js
Created March 27, 2025 11:08
functional time-series downsampling algorithms
/* Largest-Triangle-3-Buckets/MinMax in ES6
+ unit tests, run by node --test foo.js
- authors: Nicholas Kyriakides, @nicholasmin
- license: MIT
from: Downsampling Time Series for Visual Representation
Sveinn Steinarsson
University of Iceland,
https://skemman.is/handle/1946/15343
Downsampling/Decimation Algorithms
@nicholaswmin
nicholaswmin / browzen.js
Last active March 7, 2025 16:39
update a chrome tab without losing focus; macos-only
/**l
* Opens Chrome tab to a specified URL(or reload if exists)
* without the usual ballbusting focus loss on every file change.
*
* Meant for:
* `$ node --watch` or `$ nodemon app.js`
* type of orkflows where you don't
* want each file-save taking you to the browser.
*
* macOS only; no Linux/Windows
@nicholaswmin
nicholaswmin / flow.spec.md
Last active February 17, 2025 11:10
flow documentation format for LLM-assisted refactoring

flow

format for flow documenation in [LLM][llm]-assisted refactoring

This spec is given to the LLM which in turn utilizes it to
produce documentation of [system flows][flow], each showing
[state transitions][state], [steps][step], and [side effects][effect].

These flow documents support:

@nicholaswmin
nicholaswmin / test-runner.sh
Last active February 14, 2025 16:27
POSIX test runner
#!/bin/sh
# test.sh
# ----------------------
# scaffold example test:
# sh --init
#
# quickstart:
#
@nicholaswmin
nicholaswmin / validated.js
Last active February 15, 2025 11:26
type-validator function for primitives, null & array. Includes unit-tests and docs
/** @function
* @name validated
* @summary validate the type of a value
*
* @description
* validates a value against a {spec}. object, specifying:
* - parameter {name}
* - expected {type}
* {type} suppers & differentiates non-standard "array" and "null" types.
*
@nicholaswmin
nicholaswmin / reset.js
Created December 16, 2024 16:49
sensible DOM in 3 lines of code
/* examples:
$$('.button').map(el => el.on('click', console.log))
$('body').on('mouseenter', console.log) */
Node.prototype.on = Node.prototype.addEventListener
window.$ = document.querySelectorAll.bind(document)
window.$$ = (...a) => Array.from(document.querySelectorAll(...a))
@nicholaswmin
nicholaswmin / README.md
Last active December 12, 2024 14:40
pretty-inspect.js

pretty printer for object/arrays

CLI screenshot of result: 2D table. everything is colourized dimmed, except the values

const result = inspect([ { index: 1,   value: 'foo bar baz '.repeat(100) },
                         { index: 2,   value: 'foo bar baz '.repeat(10)  },
                         { index: 125, value:  null                      },
                         { index: 16,  value: 0123456789                 },
{ index: 300, value: function foo() {} },