Skip to content

Instantly share code, notes, and snippets.

View megalithic's full-sized avatar

Seth Messer megalithic

View GitHub Profile
  1. Create a Droplet on e.g. DigitalOcean.
    • Make sure it has at least 1 vCPU and 1 GB of memory.
    • Mine has: 1 vCPU, 1 GB, 35 GB NVMe SSD, Premium Intel CPU, Ubuntu 24.04 LTS for $8/month on Digital Ocean
    • Choose SSH KEY AUTHENTICATION and create a new SSH key.
    • Remember the server's IPv4 address.
  2. Sign up for a Container Registry e.g. on Digital Ocean for $5/mo (the 500MB free plan won't cut it)
    • Remember your username on the registry
  3. Create an API Token at https://cloud.digitalocean.com/account/api/tokens for pushing images to the registry.
    • It needs to have these scopes: registry (4): delete, update, read, create
  4. Install Kamal with gem install kamal
@JoosepAlviste
JoosepAlviste / typescript.lua
Last active April 9, 2025 09:20
Automatically add async to function declaration when typing "await"
---@param types string[] Will return the first node that matches one of these types
---@param node TSNode|nil
---@return TSNode|nil
local function find_node_ancestor(types, node)
if not node then
return nil
end
if vim.tbl_contains(types, node:type()) then
return node
@danilomo
danilomo / logseq_to_org.py
Created September 13, 2024 19:58
Logseq to Org roam v1
# Usage:
# - pip install marko (in a venv or system wide if you want)
# - python logseq_to_org.py <logseq's pages directory> <output folder>
import datetime as dt
import re
import sys
import uuid
from contextlib import contextmanager
from dataclasses import dataclass, field
@acalejos
acalejos / Nx_Decision_Trees.livemd
Last active January 12, 2025 03:56
Serving Spam Detection With XGBoost and Elixir

Nx-Powered Decision Trees

Mix.install(
  [
    {:exgboost, "~> 0.3.1", override: true},
    {:nx, "~> 0.6"},
    {:exla, "~> 0.5"},
@MikeBirdTech
MikeBirdTech / init.lua
Last active September 29, 2023 14:09
Hammerspoon config for triggering Start Work Day
-- Define the events that should trigger the startWorkDay function
local startWorkDayEvents = {
hs.caffeinate.watcher.systemDidWake,
hs.caffeinate.watcher.screensDidUnlock,
hs.caffeinate.watcher.screensaverDidStop
}
-- Function to check if the event should trigger the startWorkDay function
local function shouldTriggerStartWorkDay(eventType)
for _, startWorkDayEvent in ipairs(startWorkDayEvents) do
@mrbusche
mrbusche / bookmarklets.txt
Created August 24, 2022 02:20
Bookmarklets
wrap any function in
javascript: (function () {
// javascript goes here
})();
minify and then create a bookmark with the URL as the minified JavaScript
// grayscale all images without an alt tag
const css = document.createElement("style");
@benevidesh
benevidesh / zn
Last active March 12, 2024 16:10
Zettelkasten Workflow (WIP)
#!/usr/bin/bash
# zn - as zettell
# new export variables EDITOR for your editor and
#+ NOTES for your notes folder.
main () {
note_id=$(date +'%Y%m%d%H%M%S')
$EDITOR $NOTES/"$note_id".md
}
@jmatsushita
jmatsushita / README
Last active May 14, 2025 06:43
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
@agkozak
agkozak / .zshrc
Last active January 3, 2022 01:57
@kuttor's .zshrc, converted for use with zcomet
#! /bin/env zsh
# Install zcomet, if necessary
if [[ ! -f ${ZDOTDIR:-${HOME}}/.zcomet/bin/zcomet.zsh ]]; then
command git clone https://github.com/agkozak/zcomet.git ${ZDOTDIR:-${HOME}}/.zcomet/bin
fi
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
@toranb
toranb / leex_to_heex.ex
Last active July 27, 2022 21:56
inline conditional css comparison of leex and heex
##### phx live view 0.16 with leex
def render(assigns) do
~L"""
<button class="<%= if @foo && @bar && @baz do %>text-blue-600<% else %>text-red-600<% end %>">hello</button>
"""
end
##### phx live view 0.16 with heex -inline edition