Skip to content

Instantly share code, notes, and snippets.

View cmackenzie1's full-sized avatar
🏠
Working from home

Cole Mackenzie cmackenzie1

🏠
Working from home
View GitHub Profile
@cmackenzie1
cmackenzie1 / ghostty.config.ini
Created March 14, 2025 22:06
My Ghostty config
theme = light:OneHalfLight,dark:OneHalfDark
window-height = 30
window-width = 130
font-size = 14
font-family = TX-02
# delete line
keybind = cmd+backspace=esc:w
@cmackenzie1
cmackenzie1 / updated_at.sql
Created January 31, 2025 16:16
PostgreSQL Updated at column trigger
-- Function to automatically update the updated_at column
CREATE OR REPLACE FUNCTION update_updated_at_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = NOW();
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
-- Apply the trigger to all tables with an updated_at column

Settings for locking down a server with UFW

# delete all existing rules
sudo ufw reset

# enable ufw
sudo ufw enable

# defult deny everything incoming
@cmackenzie1
cmackenzie1 / biome.json
Created October 1, 2024 23:01
My biome.json
{
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": [
@cmackenzie1
cmackenzie1 / cargo-clean.sh
Created September 3, 2024 04:01
Run cargo clean on multiple directories.
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Function to display error messages and exit
error_exit() {
echo "Error: $1" >&2
exit 1
}
@cmackenzie1
cmackenzie1 / git.md
Created February 6, 2024 19:28
My favorite git commands

Copy last commit message to clipboard

git log -1 --pretty=%B | pbcopy # Can also specify -2 for last two messages. 

Is it master or main?

git branch -l master main
@cmackenzie1
cmackenzie1 / deltalake_schemas.yaml
Created June 15, 2023 16:24
Define Delta Lake table schemas in YAML.
# A top-level `type: struct` is a `Schema`
# These can be serialized into a deltalake::Schema struct using serde_yaml in rust
# let schema: deltalake::Schema = serde_yaml::from_str(r#"<your yaml>");
---
# A struct with primitive fields
type: struct
fields:
- name: String
type: string
nullable: true
@cmackenzie1
cmackenzie1 / cloudflare_logpush.tf
Last active May 11, 2022 17:55
Cloudflare + Terraform example for configuring Logpush Jobs to R2. https://developers.cloudflare.com/logs/get-started/enable-destinations/r2/
# https://developers.cloudflare.com/logs/get-started/enable-destinations/r2/
data "cloudflare_api_token_permission_groups" "all" {
resource "cloudflare_api_token" "logpush_r2_token" {
name = "logpush_r2_token"
policy {
permission_groups = [
data.cloudflare_api_token_permission_groups.all.permissions["Workers R2 Storage Write"],
@cmackenzie1
cmackenzie1 / Lightroom Manifesto.md
Last active December 21, 2024 05:45
My cheatsheet / quick guide to using Adobe Lightroom.

Lighroom Manifesto ✊

🚩 Flags:

Assign flags right after an import to filter out the obviously bad shots and ones you'd like to keep. Use your first instinct and leave undecided ones as unflagged.

  • Pick (P): In focus, eyes open, good positioning
  • Reject (X): Out of focus, blurry motion, eyes closed
  • Unflag (U):
@cmackenzie1
cmackenzie1 / build.gradle.kts
Last active March 4, 2021 04:27
Gradle dependency for Expedia GraphQL
implementation("com.expediagroup:graphql-kotlin-spring-server:3.7.0")