Skip to content

Instantly share code, notes, and snippets.

View davidk's full-sized avatar
☀️

david davidk

☀️
View GitHub Profile
@davidk
davidk / README.md
Created December 15, 2024 12:52
appImage-builder lief segmentation fault debugging

Install gdb if it is not present already. Instead of running appimage directly, it is necessary to run the Python binary, then run appimage-builder with all arguments.

$ gdb /root/.local/pipx/venvs/appimage-builder/bin/python 

(gdb) run /root/.local/bin/appimage-builder --appdir ./PrusaSlicer/build/AppDir --recipe AppImageBuilder-aarch64-full-version_2.9.0-beta1.yml

Once we reach the segmentation fault, we can use bt to get a backtrace. Running strace only revealed the call to libc, but the backtrace shows that the Python lief dependency may be failing due to an issue either in the system locale or via a change in lief itself.

@davidk
davidk / README.md
Last active July 21, 2024 06:50
k3s - Error: Kubernetes cluster unreachable: the server has asked for the client to provide credentials

Can be seen in the system log when getting the above:

Jul 21 02:16:36 $HOST k3s[47686]: E0721 02:16:36.514442 47686 authentication.go:73] "Unable to authenticate 
the request" err="[x509: certificate has expired or is not yet valid: current time $TIME is after 
$CERT_EXPIRY, verifying certificate SN=, SKID=, AKID= failed: x509: certificate has expired or is not yet 
valid: current time $TIME is after $CERT_EXPIRY]

Perform the steps in: https://docs.k3s.io/cli/certificate

@davidk
davidk / README.md
Last active March 6, 2025 08:43
SK Hynix P41 (SHPP41-1000GM) secure erase under Linux using `nvme` tooling
@davidk
davidk / README.md
Last active December 16, 2023 14:37
Solokeys v2: "Unable to load resident keys: device not found"

Error message when trying to resident keys on a Solokeys v2 for SSH authentication

rock@rock-5b:~$ ssh-add -K
Enter PIN for authenticator: 
Provider "internal" returned failure -4
Unable to load resident keys: device not found

Checking that /dev/hidraw0 is inaccessible to the local user

rock@rock-5b:~$ ls -l /dev/hidraw0 

crw------- 1 root root 236, 0 Dec 16 06:27 /dev/hidraw0

@davidk
davidk / README.md
Last active March 9, 2025 13:00
Workaround for code-server `npx argon2-cli -e`

echo -n 'password' | npx argon2-cli -e is documented as the way to created a hashed version of a password for use with code-server, but this doesn't work and argon2-cli is currently unmaintained.

Workaround

Change SALT="" to your own value: SALT="gerhgilrehilgekq"

  • Podman or Docker works as a runtime too
 $ podman run -it ubuntu
@davidk
davidk / getDisks.sh
Created August 15, 2022 02:14
Bash script to return information about SATA attached disks and their attributes
#!/bin/bash
if [[ $(id -u) -ne 0 ]]; then
echo "Run as root to access device data"
exit 1
fi
for drive in /dev/sd[a-z] /dev/sd[a-z][a-z]; do
if [[ ! -b "${drive}" ]]; then continue; fi
echo "Retrieving smart data for ${drive}"
@davidk
davidk / README.md
Last active May 8, 2024 09:55
Verifying Pop_OS! ISOs using GPG and sha256sums

How to verify Pop_OS! ISO images using GPG and sha256sums

Import the pop_os! ISO signing key, as stated here: https://github.com/pop-os/iso

$ gpg --keyserver keyserver.ubuntu.com --recv-keys 204DD8AEC33A7AFF
gpg: key 204DD8AEC33A7AFF: public key "Pop OS (ISO Signing Key) <info@system76.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

@davidk
davidk / gist:c13c7ace8cdab1bec9cbbf77842d4ffd
Last active May 7, 2021 01:06
Creating a sparse (empty space skipped) backup of a microSD card for backups
zerofree -v /dev/mmcblk0
dd if=/dev/mmcblk0 of=raspberrypi-backup.img conv=sparse bs=512 status=progress
@davidk
davidk / golang-skeleton.go
Created September 11, 2018 07:04
Golang Skeleton Generator
// Golang Skeleton Generator
// Intended for weird developers that like containing every Go project
// into it's own discrete directory with a containerized build
// (using docker-compose).
package main
import (
"flag"
"fmt"
"log"
@davidk
davidk / Dockerfile
Last active June 6, 2018 00:27
Dockerfile for easily building your own u2f tomu
# tomu-u2f builder
# ** Grab this Dockerfile and put it into a new directory on your filesystem **
# ** Build the container **
#
# docker build -t u2f-autobuild .
#
# ** Copy the file out of the image, change :z to :rw as appropriate, etc **
# docker run --rm -v $PWD:/outside:z -it u2f-autobuild cp /chopstx/u2f/build/u2f.bin /outside
#
# ** Follow the instructions here to complete flashing to your tomu **