Skip to content

Instantly share code, notes, and snippets.

View gnat's full-sized avatar
:shipit:
ez pz lemon squeezy

Nathaniel Sabanski gnat

:shipit:
ez pz lemon squeezy
View GitHub Profile
@gnat
gnat / godot.md
Last active October 30, 2024 08:56
Godot 4 Quickstart

Godot 4 Quickstart!

Legend

  • ♻️ Workflow
  • 🛠️ Tool
  • 📦 Asset or Library
  • ⭐ Guides
  • 🎨 Pattern
  • 🔥 Hot Tip
@gnat
gnat / postgres_portable_no_install.md
Last active July 22, 2024 09:47
Postgres Standalone

🐘 Postgres Standalone

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple Postgres at the same time on the same machine- Full bare metal performance.
  • Postgres is a great starter before moving to "slow single machine but horizontal scale": CockroachDB, ScyllaDB, etc.

Compile

@gnat
gnat / uuid_ulid_alternative.md
Last active June 14, 2024 19:48
64 bit ordered unique id.

Better Primary Keys / PK / id

Why not just use sequential ID's (SERIAL or AUTO INCREMENT) ?

  • Scaling writes require partitions / shards at some level.
    • Avoid SERIAL and AUTO INCREMENT from start.
      • Servers have to ask "what's the next available id in the sequence?" = huge global contention / slow down.
      • Turns into a queue. OK for 1 server. Bad for many servers.
        • Vitess and FoundationDB can work around this using sequence counters per server. Vitess one has an awful DX. Not sure about FoundationDB.
    • Alternative: Use time or random.
  • UUID bonus: Split, merge tables, and load any rows any time you wish, since rows are globally unique.
@gnat
gnat / kernel.6.2.md
Created February 20, 2023 12:28
Ubuntu 23.04 upgrade to Kernel 6.2

Installation

Linux Kernel 6.2 Final for Ubuntu 23.04

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2/amd64/linux-headers-6.2.0-060200-generic_6.2.0-060200.202302191831_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2/amd64/linux-headers-6.2.0-060200_6.2.0-060200.202302191831_all.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2/amd64/linux-image-unsigned-6.2.0-060200-generic_6.2.0-060200.202302191831_amd64.deb
@gnat
gnat / ufw_limit_raise.md
Last active January 31, 2023 13:03
ufw limit raise on ubuntu 22.04

Raise the default limit for ufw

Allows you to benefit from ufw's limit protection without being too restrictive.

tl;dr: increase --hitcount 6 to something larger in /etc/ufw/user.rules for your rule.

Example for SSH

  • Make rule ufw limit from YOUR_IP to any port 22 proto tcp
  • Increase limit
@gnat
gnat / pyinfra_vs_bash.md
Last active July 17, 2023 20:40
Pyinfra vs Shell over SSH (also Fabric, Ansible).

Overview (tl;dr:)

  • For local dev, shell scripts are pretty much always preferred. See: https://github.com/gnat/doit
    • Because 1:1 native equivalent with what is actually run on the system.
  • For inventory management, pyinfra starts paying off.

Details

Shell + SSH advantages:

  • Shines because 1:1 equivalent with what is actually run on the system.
  • A few orders of magnitude less code.
@gnat
gnat / quick_ssh.md
Last active January 6, 2023 16:19
Server / Ubuntu SSH quickstart changme.

Setup SSH

  • sudo apt install ssh curl -y
  • mkdir -p ~/.ssh; curl https://github.com/gnat.keys >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys
  • sudo echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
  • sudo systemctl reload ssh

You can now use ssh to do a proper setup.

This is can also be done at install time in the Ubuntu Server GUI.

@gnat
gnat / 30_ubuntu-unity.gschema.override
Created January 3, 2023 16:07
Ubuntu Unity patch for sane window snapping defaults during installation.
# Needs review, but goes in: /usr/share/glib-2.0/schemas/30_ubuntu-unity.gschema.override
[org.compiz.grid]
bottom-edge-action = 2
bottom-left-corner-action = 1
bottom-right-corner-action = 3
top-left-corner-action = 7
[org/compiz/profiles/unity/plugins/grid]
bottom-edge-action = 2
@gnat
gnat / mariadb_mysql_portable_no_install.md
Last active November 20, 2024 14:24
Portable Database - Standalone MariaDB and MySQL zero install.

Database Standalone Quickstart

🐬 = MySQL 8
🦭 = MariaDB

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple database at the same time on the same machine- Full bare metal performance.
@gnat
gnat / trello_discord.md
Last active April 6, 2023 20:54
Trello notification to Discord webhook using trigger (NO zapier or bs)

NO ZAPIER!

Select Board

➡️ Automation

➡️ Rules

➡️ Create Rule