Skip to content

Instantly share code, notes, and snippets.

@jamesrr39
jamesrr39 / wait-until-done.py
Created August 16, 2025 21:55
wait-until-done
#!python3
import os
import argparse
import time
parser = argparse.ArgumentParser(
prog='wait-until-done',
description='Waits until a process has completed. Usage like "python3 wait-until-done 1234 && do-next-command". Use "ps aux" to get the Process ID you are looking for.')
parser.add_argument('pid')
{
# https://caddyserver.com/docs/caddyfile/options#email
email [email protected]
}
(tls_config) {
tls {
dns digitalocean {env.DIGITAL_OCEAN_DNS_API_TOKEN}
# If you are running a DNS server on your network, controlling this domain, Caddy will resolve your DNS server to that internal server, and place the TXT entry there.
@jamesrr39
jamesrr39 / main.go
Last active January 5, 2024 10:47
convience functions for setting up Openapi-backend endpoints in Go
package main
import (
"context"
"fmt"
"net/http"
"time"
"github.com/go-chi/chi/middleware"
"github.com/go-chi/chi/v5"
@jamesrr39
jamesrr39 / vite-preact-ts.md
Last active March 21, 2025 21:46
Project scaffolding

Create and run project

Start off by using the yarn create command:

yarn create vite my-project --template preact-ts
cd my-project

Switch off telemetry (optional)

yarn config set enableTelemetry 0
@jamesrr39
jamesrr39 / server.go
Created November 17, 2022 21:49
Go HTTPS server example
package main
import (
"net/http"
"fmt"
)
/*
@jamesrr39
jamesrr39 / reflect-main.go
Created April 26, 2022 15:11
Go - reflection example
package main
import (
"fmt"
"reflect"
)
type Date struct {
Day int
Month int
@jamesrr39
jamesrr39 / tmux-cheatsheet.markdown
Created March 10, 2020 17:15 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jamesrr39
jamesrr39 / tsconfig.json
Created September 3, 2019 16:46
Tsconfig: bundle tool-free configuration, for use with es6 import style
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*"]
},
cd /tmp
wget http://rsync.samba.org/ftp/rsync/src/rsync-3.1.1.tar.gz -O - | tar xz
cd *rsync*
./configure
make
sudo make install
make clean
@jamesrr39
jamesrr39 / x (GUI) applications as another user.md
Created March 15, 2016 16:09
Running GUI applications as another user

For running GUI applications as another user

otheruser=<username>
xhost +SI:localuser:$otheruser
su $otheruser
...