Skip to content

Instantly share code, notes, and snippets.

View dantman's full-sized avatar

Daniel Friesen dantman

View GitHub Profile
{
"name": "typefabric-management-app",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "typefabric-management-app",
"version": "0.1.0",
"dependencies": {
@dantman
dantman / copilot-instructions.md
Created June 4, 2025 14:05
Prompt to automate Drizzle migration process

An AI agent should attempt to run cli commands on behalf of the user when they are needed.

Before running any command as a terminal command, the AI agent should check if there is a relevant MCP (Machine Command Protocol) command available in the project. If there is, it should use that instead of running a terminal command directly.

Check type safety using the npm run typecheck task instead of tsc directly.

Drizzle

The database schema can be found in schema.ts. For timestamp and date column types use { mode: "date" } to give the column the Date type.

@dantman
dantman / WorkspaceSetup.prompt.md
Created May 30, 2025 17:44
Daniel's preferred workspace setup as a prompt
mode
agent

We are in the folder for a new project. Your job is to set up the workspace according to my usual preferences. Here are the requirements:

Add the following scripts to package.json

{
	"scripts": {
@dantman
dantman / nvm-manage.sh
Created April 20, 2025 20:48
A Bash script that automatically manages Node.js versions with NVM, keeping specified versions updated and removing unused ones.
#!/bin/bash
# Authored by: Kagi Assistant
# https://kagi.com/assistant/6995ca12-6df0-4f88-9d91-848e993a2870
# Source NVM to make it available to the script
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Check if NVM is available
if ! command -v nvm &> /dev/null; then
@dantman
dantman / s3upload.sh
Created March 27, 2025 17:53
s3upload script for uploading backups from a really old server
#!/bin/bash
# Configuration
# ACCESS_KEY="YOUR_ACCESS_KEY"
# SECRET_KEY="YOUR_SECRET_KEY"
# BUCKET="your-bucket-name"
# REGION="your-region"
# SUBPATH="your-subpath"
# Function to upload a file
@dantman
dantman / aws-vault-sync-import.py
Created December 18, 2022 01:18
Utility for syncing credentials in WSL between aws-vault.exe and a Keepass database
import os, sys, re, shutil
from subprocess import check_call, CalledProcessError
AWS_VAULT_EXE = shutil.which('aws-vault.exe')
def process_entry(pw_entry):
if 'E' in pw_entry:
print(pw_entry['E'])
sys.exit(1)
if 'OK' in pw_entry:
@dantman
dantman / README.md
Created June 15, 2022 04:42
Test Page for of ES modules usage with nullish coalescing

Test Page for of ES modules usage with nullish coalescing

TestCafe's proxy breaks nullish coalescing. This is a basic demo using the syntax for a test case.

@dantman
dantman / gist:dd48cef249d82353d37276d955a37a34
Last active December 23, 2021 03:41
Basic TypeScript friendly validate/cast function based validation library experiment
import Axios, { AxiosError } from "axios";
// Casting/validation library
class DataInputError extends Error {
path: string[] = [];
static isDataInputError(error: unknown): error is DataInputError {
return error ? error instanceof DataInputError : false;
}
@dantman
dantman / awaitPromise.ts
Created February 17, 2021 03:17
A hook that takes a promise and throws it according to the Suspense API
interface PromiseCachePending {
promise: Promise<void>;
}
interface PromiseCacheResolved<T> {
promise: Promise<void>;
result: T;
}
interface PromiseCacheError {
promise: Promise<void>;
error: any;
@dantman
dantman / check_nvm_latest.sh
Created January 20, 2021 23:11
bashrc script used for checking for out of date nvm versions of node
#!/bin/bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
TAG="$1"
if [ -z "$TAG" ]; then
echo "Tag not specified"
exit 1
fi