Skip to content

Instantly share code, notes, and snippets.

View onpaws's full-sized avatar
🚴‍♂️
building things

Pat onpaws

🚴‍♂️
building things
View GitHub Profile
@onpaws
onpaws / temp-container.sh
Created April 18, 2024 05:07
One off k8s container
kubectl run -it --rm --restart=Never --image ubuntu tempubuntu -- /bin/bash
@onpaws
onpaws / bin2iso.sh
Created March 29, 2024 20:03
Convert bins, as in bin/cue files, into ISO
#!/usr/bin/tclsh
if {[llength $argv]!=2} {exit 1}
set in [open [lindex $argv 0] rb]
set out [open [lindex $argv 1] wb]
while {1} {
read $in 16
if {[eof $in]} {exit 0}
set user [read $in 2048]
puts -nonewline $out $user
read $in 288
@onpaws
onpaws / seafowl-logs.stdout
Created July 6, 2023 03:31
seafowl-udf-go-attempt-to-call
This file has been truncated, but you can view the full file.
2023-07-06T03:30:05.143Z DEBUG hyper::proto::h1::io > parsed 5 headers
2023-07-06T03:30:05.143Z DEBUG hyper::proto::h1::conn > incoming body is content-length (44 bytes)
2023-07-06T03:30:05.143Z DEBUG hyper::proto::h1::conn > incoming body completed
2023-07-06T03:30:05.144Z DEBUG sqlparser::parser > parsing expr
2023-07-06T03:30:05.144Z DEBUG sqlparser::parser > parsing expr
2023-07-06T03:30:05.144Z DEBUG sqlparser::parser > prefix: Value(Number("1", false))
2023-07-06T03:30:05.144Z DEBUG sqlparser::parser > get_next_precedence() TokenWithLocation { token: Comma, location: Location { line: 0, column: 0 } }
2023-07-06T03:30:05.144Z DEBUG sqlparser::parser > 0: , 1: 2 2: )
2023-07-06T03:30:05.144Z DEBUG sqlparser::parser > next precedence: 0
2023-07-06T03:30:05.144Z DEBUG sqlparser::parser > parsing
@onpaws
onpaws / cleanup-evicted-pods.sh
Created June 12, 2023 20:57
Clean up evicted pods Kubernetes
# k8s will evict pods when resources get too tight, and by default retains a long history of evictions (either >12k, or 1000 on Rancher)
# This commmand will clean up the stale/evicted pods
kubectl get pods -A | grep Evicted | while read namespace pod rest; do kubectl delete pod $pod -n $namespace; done
@onpaws
onpaws / ShowHN.md
Last active June 6, 2023 16:17
Seafowl FUSE Show HN

comment: Hello HN! I'm an engineer at Splitgraph and recently started learning Rust so I could make my first contribution to Seafowl [0], an early stage analytical database. Along the way I figured out a database hosting hack on GCP and wanted to share it with HN. It's a way to achieve "true" scale to zero database hosting that could be useful for certain side projects or spiky traffic situations.

A recurring problem I've faced with side projects is the need for Postgres, but no desire to deploy or maintain new instances. So when I learned GCP's "always free" tier includes serverless [1] I got curious to see if I could run a database.

While a lot of classic databases aren't usually a great fit for serverless, Seafowl separates compute, storage and catalog (catalog == a SQLite file of metadata). [2] Last month I was able to introduce GCS bucket compat to Seafowl, which enabled me to mount the catalog via gcsfuse (i.e. an adapter that allows attaching

@onpaws
onpaws / zgrep.sh
Created May 20, 2023 00:18
Grep over gzipped logs
zgrep 'admin_' /var/log/auth.log.*.gz
# syntax=docker/dockerfile:1
### Seafowl https://github.com/splitgraph/seafowl/blob/main/Dockerfile
# Assumes Seafowl binary is already present
# Download from https://github.com/splitgraph/seafowl/releases
FROM debian:bullseye-slim
COPY ./seafowl /usr/local/bin/seafowl
@onpaws
onpaws / curl.sh
Created March 14, 2023 19:52
HOWTO check a redirect/rewrite config with curl
curl -L -s -o /dev/null -D - www.example.com/some/path
@onpaws
onpaws / brew.sh
Created August 1, 2022 10:57
brew install --verbose --build-from-source sgr
$ brew install --verbose --build-from-source sgr
==> Downloading https://files.pythonhosted.org/packages/2d/6a/885bc91484e1aa8f618f6f0228d76d0e67000b0fdd6090673b777e311913/asciitree-0.3.3.tar.gz
Already downloaded: /Users/paws/Library/Caches/Homebrew/downloads/bbe04a2e4e9d916a520b534f8c2b90333bbea0c045f3bbfe7d5ad6a344fa116b--asciitree-0.3.3.tar.gz
==> Verifying checksum for 'bbe04a2e4e9d916a520b534f8c2b90333bbea0c045f3bbfe7d5ad6a344fa116b--asciitree-0.3.3.tar.gz'
==> Downloading https://files.pythonhosted.org/packages/d7/77/ebb15fc26d0f815839ecd897b919ed6d85c050feeb83e100e020df9153d2/attrs-21.4.0.tar.gz
Already downloaded: /Users/paws/Library/Caches/Homebrew/downloads/fe6cdd0c4ee0b8da4037c0f8bc4a7ce1f6194ca0ca06f2812515c5ad0c565913--attrs-21.4.0.tar.gz
==> Verifying checksum for 'fe6cdd0c4ee0b8da4037c0f8bc4a7ce1f6194ca0ca06f2812515c5ad0c565913--attrs-21.4.0.tar.gz'
==> Downloading https://files.pythonhosted.org/packages/cc/85/319a8a684e8ac6d87a1193090e06b6bbb302717496380e225ee10487c888/certifi-2022.6.15.tar.g
@onpaws
onpaws / brew-logs
Created July 20, 2022 12:33
brew install --verbose onpaws/splitgraph/sgr
paws@leo  /usr/local/etc  brew install --verbose onpaws/splitgraph/sgr
==> Downloading https://files.pythonhosted.org/packages/2d/6a/885bc91484e1aa8f618f6f0228d76d0e67000b0fdd6090673b777e311913/asciitree-0.3.3.tar.gz
Already downloaded: /Users/paws/Library/Caches/Homebrew/downloads/bbe04a2e4e9d916a520b534f8c2b90333bbea0c045f3bbfe7d5ad6a344fa116b--asciitree-0.3.3.tar.gz
==> Verifying checksum for 'bbe04a2e4e9d916a520b534f8c2b90333bbea0c045f3bbfe7d5ad6a344fa116b--asciitree-0.3.3.tar.gz'
==> Downloading https://files.pythonhosted.org/packages/d7/77/ebb15fc26d0f815839ecd897b919ed6d85c050feeb83e100e020df9153d2/attrs-21.4.0.tar.gz
Already downloaded: /Users/paws/Library/Caches/Homebrew/downloads/fe6cdd0c4ee0b8da4037c0f8bc4a7ce1f6194ca0ca06f2812515c5ad0c565913--attrs-21.4.0.tar.gz
==> Verifying checksum for 'fe6cdd0c4ee0b8da4037c0f8bc4a7ce1f6194ca0ca06f2812515c5ad0c565913--attrs-21.4.0.tar.gz'
==> Downloading https://files.pythonhosted.org/packages/cc/85/319a8a684e8ac6d87a1193090e06b6bbb302717496380e225ee10