Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile

microk8s & fluxcd

(optional) prepare the server

# install at https://multipass.run/
multipass launch --name microk8s-flux --mem 2G
multipass shell microk8s-flux

# assume ubuntu with snap installed, if not install it via
apt install snapd
@JohnAtl
JohnAtl / check-nvidia-cuda
Created January 5, 2024 15:25
Distrobox with Tensorflow and Nvidia support
#!/bin/bash
# Adapted from https://stackoverflow.com/a/47436840
function lib_installed() { /sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep $1; }
function check() { lib_installed $1 && echo "$1 is installed" || echo -e "\nERROR: $1 is NOT installed\n"; }
check libcuda.so
check libcudart
check libcudnn
@pythoninthegrass
pythoninthegrass / GIT_SSH.md
Last active January 4, 2024 17:58
GitHub SSH deploy key

Use SSH deploy key with GitHub

Generate SSH key

ssh-keygen -t ed25519 -C "<email>"

Point to specific SSH key

  • ~/.gitconfig: git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"
@pythoninthegrass
pythoninthegrass / .gitignore
Last active December 28, 2023 00:16
Remove repos from CircleCI via API
repos.txt
@AliOsm
AliOsm / .env
Last active December 17, 2025 14:13
Deploy Rails, GoodJob, PostgreSQL, Redis, Memcached, Meilisearch, and ChromaDB on the same server using Kamal.
KAMAL_REGISTRY_PASSWORD=dckr_pat_xXXxx_x0xXxXx-xX-XXX0xX0x-x
RAILS_MASTER_KEY=00x00xxx000xxx000000xx0x000x0x00
POSTGRES_PASSWORD=xXxxx0xXXx0
MEILI_MASTER_KEY=xXxxx0xXXx0
BLAZER_DATABASE_URL=postgres://service:{POSTGRES_PASSWORD}@service-name-postgres:5432/service_production
@pythoninthegrass
pythoninthegrass / dl-gh
Last active July 22, 2025 08:05
Download latest GitHub releases by user, repo, and extension
#!/usr/bin/env bash
# shellcheck disable=SC2207
base_url="https://github.com/$user_name/$repo_name/releases"
pkg_path=$(pwd)
distro=$(uname) # Linux / Darwin
arch=$(uname -m) # x86_64 / aarch64 / arm64
help() {
@pythoninthegrass
pythoninthegrass / bfg
Last active December 14, 2023 00:17
Shim for bfg repo cleaner
#!/usr/bin/env bash
# * Download latest bfg bin from https://rtyley.github.io/bfg-repo-cleaner/
# * Copy somewhere in path (e.g., ~/.local/bin)
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
java -jar "${SCRIPT_DIR}/bfg-1.14.0.jar" "$@"
@pythoninthegrass
pythoninthegrass / omnivore_export.py
Last active December 23, 2023 16:38
MVP for exporting 3000+ articles from Omnivore in one go via the GraphQL library.
#!/usr/bin/env python3
import json
from decouple import config
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
from gql.transport.exceptions import TransportServerError, TransportQueryError
api_key = config('OMNIVORE_API_KEY')
@pythoninthegrass
pythoninthegrass / run-ios-sim.sh
Last active August 26, 2025 16:04
Run iOS simulator from the command line.
#!/usr/bin/env bash
# shellcheck disable=SC2143,SC2317
# TODO: debug ctrl-d
# trap ctrl-c, ctrl-d, and ctrl-z
trap_card() {
echo -e "\nGoodbye!"; exit 0
}
trap trap_card SIGINT SIGQUIT SIGTSTP
@neeraj9
neeraj9 / list-directory-recursively.zig
Created October 25, 2023 04:02
List directory recursively in Zig programming language
const std = @import("std");
pub fn main() !void {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const cwd = std.os.getcwd(&buf) catch |err| {
std.debug.print("> [error] detecting current working directory, err={}\n", .{err});
return;
};
var gpa = std.heap.GeneralPurposeAllocator(.{}){};