Skip to content

Instantly share code, notes, and snippets.

type CombineTuples<T extends [[number] | number[]] | ([number] | number[])[]> =
T extends [infer A, ...infer B]
? A extends number[] | [number]
? B extends [number[] | [number]] | ([number] | number[])[]
? [...A, ...CombineTuples<B>]
: never
: never
: []
type J = CombineTuples<[[1, 2, 3], [4, 5, 6]]>
@zwhitchcox
zwhitchcox / .gitconfig
Last active April 16, 2024 08:34
git aliases
[alias]
a = add
aa = add --all
d = diff
dc = diff --cached
pl = pull
pu = push
puf = push --force
puom = push -u origin master
s = status
Some tools I use regularly include:
- TypeScript
- Node.js
- Remix (the web framework)
- postgresql
- prisma
- Tailwind
- React
---
- Always show code when suggesting changes, preferably first.
@zwhitchcox
zwhitchcox / gather
Last active November 22, 2023 03:26
copy files to clipboard for chatgpt
#!/bin/zsh
# Function to copy content to clipboard
copy_to_clipboard() {
echo "$1" | pbcopy
}
# Function to process files and copy to clipboard
process_files() {
local content=""
@zwhitchcox
zwhitchcox / create_views.ts
Created July 22, 2023 19:31
create periodic views with typescript and prisma
import { format, zonedTimeToUtc } from "date-fns-tz";
import { Group, Period } from "./types";
import { prisma } from './db';
/*
* This was copied from http://npm.im/strip-indent
*/
export const stripIndent = (str: string) => {
const match = str.match(/^[ \t]*(?=\S)/gm)
@zwhitchcox
zwhitchcox / findstart.js
Last active March 8, 2023 19:37
findStart
function findStart(strArr) {
const stations = strArr.slice(1).map((station) => station.split(':').map(parseInt))
for (let i = 0; i < stations.length; i++) {
for (let i = 0; i < stations.length; i++) {
let curGal = 0
let total = 0;
for (let j = 0; j < stations.length; j++) {
const [gallons] = stations[i + j % stations.length]
const [_, needed] = stations[(i + j + 1) % stations.length]
curGal += gallons;
@zwhitchcox
zwhitchcox / .xsetwacom
Created March 4, 2023 01:30
set up wacom tablet using udev rules
#!/usr/bin/env bash
sudo -i -u zwhitchcox xsetwacom set 'Wacom Intuos4 4x6 Pen stylus' button 3 '0'
# make sure to chmod this script with `chmod +x /home/zwhitchcox/.xsetwacom`
@zwhitchcox
zwhitchcox / slash-etc-slash-X11-slash-xorg.conf.d-slash-20-nvidia.conf
Last active March 3, 2023 00:14
configt for nvidia to fix issue with screen only
# Fixes issue where laptop's monitor ports are connected to the dGPU, while the laptop screen is connected
# to the iGPU. This can cause extreme lag when laptop lid is closed, for soem reason (possibly the iGPU
# is turned off and thus unable to render the graphics). This configuration lets the iGPU render/display
# for the laptop and the dGPU render/display for the external monitors.
# Correction: Actually, it looks like all monitors are using the NVIDA driver. However, if I remove the
# first section, my laptop lid doesn't work so, idk
# This section sets up the Intel integrated graphics as the primary driver
@zwhitchcox
zwhitchcox / resume.json
Last active December 2, 2022 21:53
resume
{
"basics": {
"name": "Zane Hitchcox",
"label": "(Hardware/Software) (Engineer/Hacker)",
"email": "zwhitchcox@gmail.com",
"phone": "865.236.0804",
"url": "https://zanehitchcox.com",
"summary": "I'm a hardware and software engineer and hacker.\nI like solving challenging problems and creating innovative technology.\nMostly web focused and early adopter of things like NodeJS, React, Rust, Docker, Kubernetes, WASM/WASI, etc.",
"location": {
"city": "Knoxville",
make clean
emconfigure ./configure --host=x86_64-gnu-linux --prefix=$(readlink -f prefix) --disable-imager --disable-defrag --disable-tls --disable-uuidd --disable-mmp --disable-tdb --disable-bmap-stats --disable-nls --disable-fuse2fs --disable-fsck --disable-libuuid --without-pthread CFLAGS=""
cp -f ../e2fsprogs/lib/ext2fs/gen_crc32ctable ./lib/ext2fs/gen_crc32ctable
cp -f ../e2fsprogs/util/subst ./util/subst
chmod +x ./util/subst
emmake make
echo 'resize2fs.js: $(RESIZE_OBJS) $(DEPLIBS)