Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / preseed.yml
Created April 18, 2025 15:43
lxd init preseed config
config:
core.https_address: '[::]:8443'
networks:
- config:
ipv4.address: auto
ipv6.address: auto
description: ""
name: lxdbr0
type: ""
project: default
@pythoninthegrass
pythoninthegrass / distrobox.conf
Created March 30, 2025 18:25
Distrobox config ~/.config/distrobox/distrobox.conf
container_always_pull="1"
container_generate_entry=0
container_manager="docker"
container_image_default="registry.fedoraproject.org/fedora-toolbox:latest"
container_name_default="distrobox-default"
container_user_custom_home="$HOME/.config/distrobox/home"
# container_init_hook="~/.local/distrobox/a_custom_default_init_hook.sh"
# container_pre_init_hook="~/a_custom_default_pre_init_hook.sh"
non_interactive="1"
skip_workdir="0"
@pythoninthegrass
pythoninthegrass / proxy.py
Created February 12, 2025 01:32
Proxy requests from a free list at https://api.proxyscrape.com
#!/usr/bin/env python
import json
import requests
from pathlib import Path
from requests.exceptions import RequestException
from urllib.parse import urlencode
def get_my_ip():
@pythoninthegrass
pythoninthegrass / config
Last active April 15, 2025 15:17
Ghosty config (i.e., $HOME/.config/ghostty/config )
title = " "
maximize = true
working-directory = "home"
quit-after-last-window-closed = true
quick-terminal-screen = mouse
quick-terminal-autohide = true
scrollback-limit = 524288000
clipboard-read = allow
clipboard-write = allow
clipboard-paste-protection = false
[env]
TERM = "xterm-256color"
[terminal.shell]
program = "/usr/bin/bash"
args = ["-l", "-c", "zellij"]
[window]
dimensions.columns = 100
dimensions.lines = 34
@pythoninthegrass
pythoninthegrass / cleanup.sh
Last active November 13, 2024 19:16
Cleanup ubuntu servers (non)interactively (cf. no disk space left)
#!/usr/bin/env bash
set -euo pipefail
# $USER
[[ -n $(logname >/dev/null 2>&1) ]] && logged_in_user=$(logname) || logged_in_user=$(whoami)
# $UID
# logged_in_uid=$(id -u "${logged_in_user}")
@pythoninthegrass
pythoninthegrass / deploy.sh
Last active November 12, 2024 04:47
Spin up a kind cluster with jupyterhub
#!/usr/bin/env bash
set -e
# Clean up function
cleanup() {
echo "Cleaning up existing cluster..."
kind delete cluster
}
@pythoninthegrass
pythoninthegrass / Earthfile
Created November 11, 2024 02:32
Multiplatform rust build and containerization using earthly
VERSION 0.8
ARG --global APP_NAME="hello_rust"
ARG --global PROFILE=release
all:
BUILD \
--platform=linux/amd64 \
--platform=linux/arm64 \
+docker
@pythoninthegrass
pythoninthegrass / archive.sh
Last active January 16, 2025 19:51
Clean up git directories (.venv, .terraform, node_modules, and target). Then archive repos.
#!/usr/bin/env bash
# shellcheck disable=SC2155
# Environment variable overrides with defaults
OUTPUT_DIR="${OUTPUT_DIR:-${HOME}/Downloads/git_archive}"
ARCHIVE_FORMAT="${FORMAT:-zip}"
MAX_DEPTH="${MAX_DEPTH:-2}"
# Create output directory if it doesn't exist
@pythoninthegrass
pythoninthegrass / hello_docker.py
Created October 23, 2024 22:09
Use the python docker sdk to run a container in detached mode
#!/usr/bin/env python
import docker
client = docker.from_env()
container = client.containers.run("ubuntu:latest",
command=["echo", "hello", "world!"],
detach=True,
remove=False,