Skip to content

Instantly share code, notes, and snippets.

@cholmes
cholmes / time-duckdb.py
Created January 14, 2025 17:58
Time query of DuckDB httpfs spatial filtering
import time
import duckdb
def run_duckdb_query():
# Connect to DuckDB (using an in-memory database as an example)
conn = duckdb.connect(database=':memory:')
# Load the spatial extension
conn.execute("LOAD spatial")
@knyazer
knyazer / add_to_fish_config.fish
Last active January 21, 2025 21:51
Bringing AI to Git commit.
function gcm
# Check if llm is installed, if not, install it
if not type -q llm
echo "'llm' is not installed. Attempting to install it using pip..."
if pip install llm
echo "'llm' installed successfully."
else
echo "Failed to install 'llm'. Please install it manually and try again."
return 1
end
@karpathy
karpathy / add_to_zshrc.sh
Created August 25, 2024 20:43
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) gets the current staged changed diff
# 2) sends them to an LLM to write the git commit message
# 3) allows you to easily accept, edit, regenerate, cancel
# But - just read and edit the code however you like
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/
gcm() {

Important

DO NOT USE VSCODE terminal and make sure uname -m returns arm64

  1. First Install Xcode command line tool
xcode-select --install
  1. Create and change /opt directories owner
@azlen
azlen / bulletpaths.js
Last active February 28, 2025 16:24
All Paths Lead to Roam
/*
* credit to Dhrumil Shah (@wandcrafting) and Robert Haisfield (@RobertHaisfield)
* for the original concept which was part of their RoamGames submission
* and can be found at: https://www.figma.com/file/5shwLdUCHxSaPNEO7pazbe/
*
*/
/* ======= OPTIONS ======== */
/* note: if you change these, reload the page to see the effect */
@ityonemo
ityonemo / test.md
Last active April 29, 2025 08:28
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@benkehoe
benkehoe / aws_assume_role.py
Last active November 13, 2022 13:48
Assumed role session chaining (with credential refreshing) for boto3
# *** WARNING ***
# This gist is no longer maintained
# It has been replaced by aws-assume-role-lib in PyPI
# Documentation at https://github.com/benkehoe/aws-assume-role-lib
# It is still a single-file library, you can find the stable version here:
# https://raw.githubusercontent.com/benkehoe/aws-assume-role-lib/stable/aws_assume_role_lib/aws_assume_role_lib.py
# (link also available in the docs)
# Copyright 2020 Ben Kehoe
#
@benkehoe
benkehoe / aws-profile-for-bashrc.sh
Last active April 4, 2025 17:16
AWS_PROFILE env var management
# MIT No Attribution
#
# Copyright 2022 Ben Kehoe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
@romainl
romainl / Don't use Vim.md
Last active April 29, 2025 07:22
Don't use Vim for the wrong reasons

Don't use Vim

Don't do the crime, if you can't do the time.

-- Anthony Vincenzo "Tony" Baretta

Vim is an amazing text editor. I love it. Really, I wouldn't [organize][organize] a Vim advent calendar if I didn't. But, as amazing as it is, Vim is not for everyone. It can't solve all your problems, or be a TUI version of your favorite IDE, or make you a better programmer, or land you that dream job in the Bay Area. But Vim can help you be more mindful, focused, and efficient, as long as you approach it with the right mindset.

Don't get me wrong, I certainly welcome you to try Vim, but I'm not a proselyte. I don't thrive on newbies. I just want you to use the right tool for the job and not waste your—and anyone's—time on a fruitless quest.

import mercantile
from shapely.geometry import box, shape
from supermercado import burntiles
minzoom = 7
maxzoom = 12
maximum_items_per_tile = 20
def stac_to_mosaicJSON(data):
dataset = data["features"]