Skip to content

Instantly share code, notes, and snippets.

# Function to create a git worktree with UV environment setup
create_worktree() {
local branch_name="$1"
local start_branch="$2"
# Validate arguments
if [[ -z "$branch_name" ]]; then
echo "Usage: create_worktree <branch_name> [start_branch]"
echo "Example: create_worktree my-feature-branch master"
echo " create_worktree my-feature-branch # uses current branch"
@cmpadden
cmpadden / duckdb-dagster-graphql-materializations.sql
Last active October 29, 2024 02:55
Dagster Materializations from DuckDB via GraphQL
install http_client from community;
load http_client;
with __input as (
select
http_post(
'http://localhost:3000/graphql',
headers => map {
'content-type': 'application/json',
@cmpadden
cmpadden / midi-to-audio-backed-mp4.sh
Created June 29, 2024 03:45
Convert midi files to instrument backed video
#!/bin/bash
TARGET_MIDI_FILE="bk_cove.mid"
STATIC_COVER_IMAGE="${HOME}/Downloads/bk_cover_image.jpg"
# open midi file in Logic Pro
open "$TARGET_MIDI_FILE"
# use `osascript` to bounce the project, converting midi tracks to an audio file
osascript \
@hbowron
hbowron / README.md
Last active February 5, 2024 15:17
Redirecting Graphite PRs to Github

How to use the Graphite Dashboard with Github PRs

Set up your dashboard

  1. Navigate to https://app.graphite.dev/
  2. Ensure Default repos is set to your most frequently used repositories
  3. Create a Waiting on me section and add the following filters (and ANDed):
    1. Directly includes reviewer: <your handle>
    2. PR Status is: Open
  4. Review status is: Review required
#! /usr/bin/python
from scapy.all import *
import sys, ifaddr, os
bad_sites = [
'reddit.com',
'youtube.com',
'news.ycombinator.com',
'wsj.com',
@inchoate
inchoate / including_external_package_in_dataflow.md
Last active February 2, 2024 11:40
Adding an extra package to a Python Dataflow project to run on GCP

The Problem

The documentation for how to deploy a pipeline with extra, non-PyPi, pure Python packages on GCP is missing some detail. This gist shows how to package and deploy an external pure-Python, non-PyPi dependency to a managed dataflow pipeline on GCP.

TL;DR: You external package needs to be a python (source/binary) distro properly packaged and shipped alongside your pipeline. It is not enough to only specify a tar file with a setup.py.

Preparing the External Package

Your external package must have a proper setup.py. What follow is an example setup.py for our ETL package. This is used to package version 1.1.1 of the etl library. The library requires 3 native PyPi packages to run. These are specified in the install_requires field. This package also ships with custom external JSON data, declared in the package_data section. Last, the setuptools.find_packages function searches for all available packages and returns that

@TSMMark
TSMMark / delete_local_branches.sh
Last active January 12, 2025 23:16
Delete local branches that don't exist on remote/origin !USE AT YOUR OWN RISK!
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 git branch -D
@heptal
heptal / amphetamine.md
Last active January 17, 2025 07:43
Hammerspoon replacement for Caffeine

Amphetamine

Simple toggleable menubar replacement for Caffeine in Hammerspoon, utilizing ASCIImage (for vector) to create the amphetamine icons. Motivated by the official Caffeine app's icon looking bad on Retina

Get latest version here: amphetamine.lua

Save as amphetamine.lua in ~/.hammerspoon/ and put amphetamine = require "amphetamine" in your init.lua

@XVilka
XVilka / TrueColour.md
Last active November 27, 2025 14:11
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@jackrusher
jackrusher / gist:5139396
Last active November 24, 2025 08:59
Hofstadter on Lisp: Atoms and Lists, re-printed in Metamagical Themas.

Hofstadter on Lisp

In the mid-80s, while reading through my roommate's collection of Scientific American back issues, I encountered this introduction to Lisp written by Douglas Hofstadter. I found it very charming at the time, and provide it here (somewhat illegally) for the edification of a new generation of Lispers.

In a testament to the timelessness of Lisp, you can still run all the examples below in emacs if you install these aliases:

(defalias 'plus #'+)
(defalias 'quotient #'/)
(defalias 'times #'*)
(defalias 'difference #'-)