Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / biome.jsonc
Created October 19, 2024 22:07
biome config (used primarily as json formatter in zed)
// https://biomejs.dev/formatter/#options
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"formatter": {
"enabled": true,
"useEditorconfig": true,
"formatWithErrors": true
},
"json": {
@pythoninthegrass
pythoninthegrass / 01-machines.json.j2
Last active October 15, 2024 20:34
Setup cockpit on multiple servers via ansible
{%- set excluded_ips = [
'^192\.168\.8\.',
'^192\.168\.25\.',
'^192\.168\.105\.'
] -%}
{
{% for host in groups['all'] %}
{%- set ip = hostvars[host]['ansible_host'] | default(host) -%}
{%- if ip is not match(excluded_ips | join('|')) and host != 'localhost' and host != 'lance@orb' %}
"{{ ip }}": {
@pythoninthegrass
pythoninthegrass / Dockerfile
Created October 7, 2024 23:01
wip docker compose setup of tauri based in part on https://www.the-great.dev/blog/2024-02-04-tauri-docker
# syntax=docker/dockerfile:1.7.0
FROM lukemathwalker/cargo-chef:latest-rust-slim-bookworm AS base
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libwebkit2gtk-4.0-dev \
build-essential \
curl \
@pythoninthegrass
pythoninthegrass / gum_log.sh
Last active October 2, 2024 22:23
gum logging mvp
#!/usr/bin/env bash
# Function to log using gum
logger() {
local level msg OPTIND log_file log_dir log_path
level=""
msg=""
log_dir="/tmp"
log_file="gum.log"
log_path="${log_dir}/${log_file}"
@pythoninthegrass
pythoninthegrass / simple_server.py
Created September 25, 2024 22:06
http.server implementation of serving unencrypted directory content (e.g., kickstart files) over port 8000
#!/usr/bin/env python
import http.server
import os
import socketserver
from pathlib import Path
PORT = 8000
if os.getenv("WORK_DIR") is not None:
@pythoninthegrass
pythoninthegrass / cloud-init.yml
Last active October 2, 2025 21:48
Minimal cloud-config for harvester ubuntu cloud image
#cloud-config
output: { all: '| tee -a /var/log/cloud-init.log' }
timezone: "America/Chicago"
hostname: ubuntu
package_update: true
@pythoninthegrass
pythoninthegrass / 99-motd.sh
Last active September 22, 2024 00:47 — forked from arvati/alpine_motd_generator.md
Dynamic motd generator for Alpine Linux
#!/bin/sh
. /etc/os-release
PRETTY_NAME=`awk -F= '$1=="PRETTY_NAME" { print $2 ;}' /etc/os-release | tr -d '"'`
VERSION_ID=`awk -F= '$1=="VERSION_ID" { print $2 ;}' /etc/os-release`
UPTIME_DAYS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 / 86400)
UPTIME_HOURS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 / 3600)
UPTIME_MINUTES=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 % 3600 / 60)
cat > /etc/motd << EOF
@pythoninthegrass
pythoninthegrass / nikto.sh
Last active September 11, 2024 18:47
nikto docker shim
#!/usr/bin/env bash
set -e
help() {
cat <<- DESCRIPTION >&2
Shim to run nikto in a container.
SETUP
git clone https://github.com/sullo/nikto
@pythoninthegrass
pythoninthegrass / keymap.json
Last active May 15, 2025 18:48
zed config
// Zed keymap
//
// For information on binding keys, see the Zed
// documentation: https://zed.dev/docs/key-bindings
//
// To see the default key bindings run `zed: open default keymap`
// from the command palette.
[
// Standard bindings
{
@pythoninthegrass
pythoninthegrass / kestra-python.yml
Created August 29, 2024 21:18
Use namespace files to run a basic python script on the kestra host
id: editor
namespace: company.team
tasks:
- id: hello
type: io.kestra.plugin.scripts.python.Script
namespaceFiles:
enabled: true
script: "{{ read('scripts/hello.py') }}"