Skip to content

Instantly share code, notes, and snippets.

View greyltc's full-sized avatar
💭
I may be slow to respond.

M. Greyson Christoforo greyltc

💭
I may be slow to respond.
View GitHub Profile
/// function 1: fine
pub async fn spawn(self, addr: SocketAddr) -> Result<impl Server, Box<dyn std::error::Error>> {
let storage = Disk::new(self.path).map_err(Error::from).await?;
let storage = Verify::new(storage);
log::info!("Local disk storage initialized.");
Ok(spawn_server(storage, &addr))
}
@greyltc
greyltc / nspawn_fail_log3.txt
Created February 6, 2024 12:47
nspawn fail log 3
$ sudo systemd-nspawn --link-journal=host --boot --image /dev/sda init --log-level=debug
Spawning container sda on /dev/sda.
Press Ctrl-] three times within 1s to kill container.
systemd 255.3-1-arch running in system mode (+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
Detected virtualization systemd-nspawn.
No confidential virtualization detection on this architecture
Detected architecture arm64.
Detected initialized system, this is not the first boot.
Kernel version 6.7.3-arch1-2, our baseline is 4.15
No credentials passed from initrd.
@greyltc
greyltc / nspawn_logv2.txt
Last active February 6, 2024 06:47
systemd-nspawn for arm64
$ sudo systemd-nspawn --link-journal=host --capability=CAP_SYS_ADMIN --boot --image /dev/sda init --log-level=debug
Spawning container sda on /dev/sda.
Press Ctrl-] three times within 1s to kill container.
systemd 255.3-1-arch running in system mode (+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
Detected virtualization systemd-nspawn.
No confidential virtualization detection on this architecture
Detected architecture arm64.
Detected initialized system, this is not the first boot.
Kernel version 6.7.3-arch1-2, our baseline is 4.15
No credentials passed from initrd.
@greyltc
greyltc / rpicam_build_from_git.sh
Last active January 31, 2024 11:22
rebuilds all the rpi5 camera stuff from git
#!/usr/bin/env bash
# curl https://gist.githubusercontent.com/greyltc/13111f281aeb094337e6aac22baf0e6a/raw | bash
set -o pipefail
set -o errexit
set -o nounset
# tested working on vanilla Raspberry Pi OS (bookworm, 64bit) on my rpi5 on 29 jan 2024
# camera software usage docs: https://www.raspberrypi.com/documentation/computers/camera_software.html
sudo sed 's,^#deb-src http://archive.raspberrypi.com,deb-src http://archive.raspberrypi.com,' -i /etc/apt/sources.list.d/raspi.list
@greyltc
greyltc / mkarchroot_by_date.sh
Last active November 14, 2023 17:49
mkarchroot as if it was run on a given date (by using the Arch Linux Archive)
#!/usr/bin/env bash
#bash <(curl -sL https://gist.github.com/greyltc/d17802b7ed5ba0c56146b17497c9cb8e/raw) 2020-01-01 base-devel vim
TRAVEL_TO="${1}" # 2020-01-01, for example
PACKAGES="${@:2}"
TIMETRAVEL_ROOT="timetravel_${TRAVEL_TO}"
#sudo rm -rf "${TIMETRAVEL_ROOT}"
@greyltc
greyltc / makepkg-url.sh
Last active April 9, 2023 16:28
builds an Arch package from files given in a (curl glob formatted) URL
#!/usr/bin/env bash
# builds an Arch package from files given in a (curl glob formatted) URL
# example usage; (re)build and install the aurutils package:
# bash <(curl -sL https://gist.github.com/greyltc/8a93d417a052e00372984ff8ec224703/raw) "https://aur.archlinux.org/cgit/aur.git/plain/{PKGBUILD,aurutils.changelog,aurutils.install}?h=aurutils" -if
set -e
TMPDIR=$(mktemp -p /var/tmp --directory)
touch "${TMPDIR}/.deleteme"
@greyltc
greyltc / wget-glob-fetch.sh
Created February 11, 2022 11:49
wget globbing
#!/bin/sh
wget -e robots=off -r --no-parent -A 'file-name-prefix.*.pkg.tar.zst' https://host.name/patha/pathb/
@greyltc
greyltc / analytical_sln_to_solar_cell_eqn.py
Last active November 22, 2021 17:54
analytical solution for non-ideal solar cell equation
#!/usr/bin/env python3
"""
written by Grey Christoforo <first name [at] last name [not] net>
analytical solution for non-ideal solar cell equation
"""
import sympy
# make symbols
@greyltc
greyltc / rewrite-git-author-history.md
Last active January 18, 2022 13:41
Changing Git History Author Info

Changing the Git history of your repository using a script[1]

We've created a script that will change any commits that previously had the old email address in its author or committer fields to use the correct name and email address.

Before running this script, you'll need:

  • The old email address that appears in the author/committer fields that you want to change
  • The correct name and email address that you would like such commits to be attributed to
  1. Open a terminal.
  2. Create a fresh, mirror clone of your repository:
@greyltc
greyltc / make_holes.py
Created August 20, 2021 10:39
python holemaker
#!/usr/bin/env python3
"""script that puts holes into pcb"""
import pcbnew
class HoleMaker(object):
"""puts holes into a pcb, units are mm"""
board_filename = None
pcb = None