Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am johnmaguire on github.
  • I am johnmaguire (https://keybase.io/johnmaguire) on keybase.
  • I have a public key whose fingerprint is 74E0 3311 17FC B721 C125 C430 19BE AD94 6ED2 DEE5

To claim this, I am signing this object:

#!/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
@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')

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 / 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
@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 / 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"
#!/bin/sh
tmux list-sessions -F '#S' \
| awk 'BEGIN {ORS=" "} {print $1, NR, "\"switch-client -t", $1 "\""}' \
| xargs tmux display-menu -T "Switch-session"
--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai stl| read writ| recv send| in out | int csw
12 12 74 2 0|4924k 0 | 22M 39M| 0 0 |9563 2422
12 13 68 7 0| 308k 71M| 24M 43M| 12k 0 | 13k 6590
11 12 76 1 0|5164k 4096B| 19M 35M| 0 0 |5622 3090
10 7 81 2 0|4224k 120k| 12M 18M| 0 0 |5117 3059
13 10 76 0 0|1672k 0 | 20M 37M| 0 0 |6431 2545
10 29 61 1 0|5144k 0 | 21M 40M| 0 0 | 31k 2888
10 44 38 8 0| 336k 465M| 23M 44M| 0 0 | 35k 9204
14 12 69 5 0| 152k 7100k| 23M 43M| 0 0 |8349 4564
00:18:51.513 Cloning repository...
00:18:52.660 From https://github.com/johnmaguire/helical-piers
00:18:52.660 * branch 09e1545825ca73d66f47bf32855c606e091a0c65 -> FETCH_HEAD
00:18:52.661
00:18:52.738 HEAD is now at 09e1545 Try logging values for contact form
00:18:52.739
00:18:52.849
00:18:52.883 Success: Finished cloning repository files
00:18:53.723 Detected the following tools from environment: [email protected], [email protected]
00:18:53.724 Installing project dependencies: npm install --progress=false