Skip to content

Instantly share code, notes, and snippets.

@kiltyj
kiltyj / devenv-init.sh
Last active June 20, 2024 17:00
Onboarding script for Nix + Xcode
#!/bin/zsh
echo "To prepare for later steps, download https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_15/Xcode_15.xip to ~/Downloads"
echo "Press enter once you've initiated this download."
vared -c dummy_var
if [ "$RESIZE_VM" = true ]; then
echo Y | diskutil repairDisk disk0
diskutil apfs resizeContainer disk0s2 0
fi
@adamlacombe
adamlacombe / cloudflare_zone_token_generator.sh
Last active October 11, 2025 06:34
This bash script automates the process of creating a Cloudflare API token with full zone permissions. It fetches all permission groups that have a scope related to zones. Once the appropriate permission groups are retrieved, the script creates a new API token with these permissions for a specific zone, which is defined by the ZONE_ID variable. A…
#! /bin/bash
# 1) Make file executable: chmod +x cloudflare_zone_token_generator.sh
# 2) Set variable values: API_KEY, EMAIL_ADDRESS, ZONE_ID
# 3) ./cloudflare_zone_token_generator.sh
# Global API Key: https://dash.cloudflare.com/profile/api-tokens
API_KEY=""
# Email address associated with your account
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active October 21, 2025 06:41
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@Aerijo
Aerijo / tree_sitter_guide.md
Last active October 12, 2025 14:41
Guide to writing your first Tree-sitter grammar

Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

About

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.

@Aerijo
Aerijo / making_language_grammar.md
Last active September 20, 2025 20:59
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

@gyribeiro
gyribeiro / tmux_italic.md
Last active September 6, 2025 12:36
enable italic font on tmux
@kn9ts
kn9ts / aws4_signing.py
Last active September 2, 2025 16:50
AWS V4 signing example in python
# AWS Version 4 signing example
#
# Example:
# Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/iam/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7
# Formulae:
# CanonicalRequest =
# HTTPRequestMethod + '\n' +
# CanonicalURI + '\n' +
# CanonicalQueryString + '\n' +

How do I prompt for input in a Linux shell script?

Edit 2015-10-29: Adding readline's history capacity Depending on posix compliant: could work on poor system with generic shell environments bash specific: using so called bashisms and if you want simple in line question / answer (generic solutions) pretty formated interfaces, like ncurses or more graphical using libgtk or libqt... use powerful readline history capability (new oct 2015)

@staltz
staltz / introrx.md
Last active October 21, 2025 02:57
The introduction to Reactive Programming you've been missing