Skip to content

Instantly share code, notes, and snippets.

@tgran2028
tgran2028 / windows-keys.md
Created June 22, 2025 08:30 — forked from rvrsh3ll/windows-keys.md
Windows Product Keys

NOTE

These are NOT product / license keys that are valid for Windows activation.
These keys only select the edition of Windows to install during setup, but they do not activate or license the installation.

Index

@tgran2028
tgran2028 / windows-keys.md
Created June 22, 2025 08:30 — forked from rvrsh3ll/windows-keys.md
Windows Product Keys

NOTE

These are NOT product / license keys that are valid for Windows activation.
These keys only select the edition of Windows to install during setup, but they do not activate or license the installation.

Index

@tgran2028
tgran2028 / _gio
Created June 4, 2025 22:04
zsh completion for gio
#compdef gio
# Usage:
# gio COMMAND [ARGS…]
#
# Commands:
# help Print help
# version Print version
# cat Concatenate files to standard output
# copy Copy one or more files

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@tgran2028
tgran2028 / 1-setopts.zsh
Created March 17, 2025 05:19 — forked from mattmc3/1-setopts.zsh
ZSH - options by framework
## ZSH Options
# http://zsh.sourceforge.net/Doc/Release/Options.html
# Changing Directories
# http://zsh.sourceforge.net/Doc/Release/Options.html#Changing-Directories
setopt auto_cd # if a command isn't valid, but is a directory, cd to that dir
setopt auto_pushd # make cd push the old directory onto the directory stack
setopt pushd_ignore_dups # don’t push multiple copies of the same directory onto the directory stack
setopt pushd_minus # exchanges the meanings of ‘+’ and ‘-’ when specifying a directory in the stack
@tgran2028
tgran2028 / cargo-bin-export.sh
Created February 27, 2025 09:10
Export installed bin crates metadata to JSON
#!/usr/bin/env bash
#
# export installed cargo binaries as JSON
set -euo pipefail
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ! command -v cargo &> /dev/null; then
if [[ -x $HOME/.cargo/bin/cargo ]]; then
[[ -r $HOME/.cargo/env ]] && source "$HOME/.cargo/env"
CMD=$HOME/.cargo/bin/cargo
else
@tgran2028
tgran2028 / path-default
Created February 26, 2025 05:35
set default $PATH
#!/usr/bin/env bash
export PIPX_HOME=$HOME/.local/python-utils
export PIPX_BIN_DIR=$HOME/.local/python-utils/bin
export DOTNET_ROOT=$HOME/.dotnet
export CARGO_HOME=$HOME/.cargo
export NVM_DIR=$HOME/.nvm
export MAMBA_ROOT_PREFIX=$HOME/.local/share/micromamba
export GOROOT=/usr/local/go
export GOPATH=$HOME/.local/go
@tgran2028
tgran2028 / json-convert.sh
Created February 26, 2025 02:36
Use yq to convert serialized formats
#!/bin/bash
# Function to parse and validate format options
parse_format() {
local -l fmt=$1
case "$fmt" in
a | auto) echo "auto" ;;
y | yaml) echo "yaml" ;;
j | json) echo "json" ;;
p | props) echo "props" ;;
@tgran2028
tgran2028 / github_render_md.py
Last active February 18, 2025 15:34
CLI program to utilize GitHub's markdown rendering API endpoint.
#!/usr/bin/env python3
import argparse
import os
import sys
from pathlib import Path
from typing import Callable
import json
import requests
@tgran2028
tgran2028 / get-vscode-commands.sh
Created February 10, 2025 17:07
Extract all vscode commands
#!/bin/bash
# manually save the default keybindings to a file
defaults="$TEMP/keybindings.vscode-default.jsonc"
mapfile -t used_commands < <(
jsonc read < "$defaults" |
jq -M '.[].command' |
xargs -n1
)