Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
tmux list-sessions -F '#S' \
| awk 'BEGIN {ORS=" "} {print $1, NR, "\"switch-client -t", $1 "\""}' \
| xargs tmux display-menu -T "Switch-session"
@johnmaguire
johnmaguire / README.md
Last active July 20, 2023 20:18
Example Dockerfiles for dnclient host networking

Building

Alpine-based image

docker build . \
    --file alpine.Dockerfile \
    --tag "dnclient:alpine-latest" \
    --tag "dnclient:latest"
@johnmaguire
johnmaguire / Dockerfile
Created January 30, 2023 22:22
inotify wrapper - Use inotify to watch for changes (saved from a 2019 repo)
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENTRYPOINT [ "python", "./main.py" ]
@johnmaguire
johnmaguire / Arch-Laptop.txt
Last active March 25, 2021 22:17
Benchmarking Argon2 KDF on my machines
jmaguire@scorpion [05:56:26 PM] [~/src/nebula/cert] [pkey-benchmarking]
-> % go test -bench=. -benchtime=10x
go: downloading github.com/golang/protobuf v1.4.1
go: downloading google.golang.org/protobuf v1.25.0
go: downloading golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
goos: linux
goarch: amd64
pkg: github.com/slackhq/nebula/cert
cpu: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
BenchmarkAes256DeriveKey-8 10 2058243018 ns/op

Plex Music Metadata

Fetching a list of songs from my old Plex library after a hard drive failure...

Descriptive Metadata (things to look for)

  • Title
  • Performing Artist
  • Album
  • Release Date
  • Track #
@johnmaguire
johnmaguire / download_anki.py
Last active December 12, 2022 20:35
Some simple code I wrote to download multiple decks for Marilyn
import json
import os
import re
from collections import namedtuple
from operator import attrgetter
import requests
DOWNLOAD_DIR = os.path.join(os.path.realpath(os.path.dirname(__file__)),
'downloads')
#!/bin/bash
encrypted_root=0
encrypted_home=0
# Determine what is mounted at / and /home
root_mount="$(findmnt --noheadings --raw --target / | awk '{ print $2 }')"
home_mount="$(findmnt --noheadings --raw --target /home | awk '{ print $2 }')"
# check if root