Skip to content

Instantly share code, notes, and snippets.

View chneeb's full-sized avatar

Christian Neeb chneeb

View GitHub Profile
@Davis-A
Davis-A / raidz expansion
Last active November 10, 2023 20:00
Someone in lobste.rs asked if you could expand a 4 disk raidz3 into a larger and larger pool. The answer is yes! https://lobste.rs/s/roqgoz/zfs_raidz_expansion_merged#c_rqtyqg
[root@devbox ~]# # --- zfs version ----
[root@devbox ~]# zfs version
zfs-2.2.99-0
zfs-kmod-2.2.99-0
[root@devbox ~]# # --- note: 2.2.99 is what you get if you build of master at the moment ---
[root@devbox ~]# # --- Create some disks ----
[root@devbox ~]# mkdir -p /root/zfs-sparse/
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d1.img
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d2.img
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d3.img
@daemonhorn
daemonhorn / freebsd_yubikey_authentication.md
Last active May 4, 2024 19:00
Setting up yubikey/solo2 for piv, fido, and gpg on FreeBSD (Firefox, Chromium, PAM, SSH, and GnuPG)

Overview

How to configure FreeBSD and applicable applications to work with Yubikey for authentication. This serves as my work-in-progress documentation of the configuration knobs needed to make this work properly.

  • FreeBSD ssh with piv smartcard slot on Yubikey (pkcs11 via libykcs11.so)
  • FreeBSD ssh with fido support on Yubikey
  • FreeBSD Firefox/Chromium with fido + webauthn support on Yubikey
  • FreeBSD local console and gdm authentication using pam on Yubikey
  • FreeBSD official YubiKey tools

Latest Tested FreeBSD versions

  • FreeBSD 13.2 Testing (Aug 2023)
  • FreeBSD stable/13 Testing (Aug 2023) with OpenSSH_9.3p2
@pietrorea
pietrorea / mysql-here-document.sh
Created January 28, 2022 16:47
MySQL here document example
mysql -u root --password="${PASSWORD}" <<EOF
CREATE DATABASE ${DB_NAME};
CREATE USER '${APP_USER}'@'localhost' IDENTIFIED BY '${APP_PASSWORD}';
GRANT ALL ON ${DB_NAME}.* TO '${APP_USER}'@'localhost'
EOF
@74th
74th / ccs811.py
Created May 4, 2021 00:12
CCS811 MicroPython for Raspberry Pi PICO
import time
from machine import I2C, Pin
_ADDR = 0x5B
class CCS811:
def __init__(self, i2c: I2C):
self._i2c = i2c
@afresh1
afresh1 / openbsd-httpd-fastcgi-notes.md
Created July 12, 2020 21:26
Notes on how OpenBSD's httpd handles its FastCGI parameters. Debugging it with slowcgi.

These examples all live in a default server block in your httpd.conf(5).

server "default" {
	listen on * port 80
	... # all the location blocks can together right here
}

We'll be using slowcgi(8) as the example, because with the -d flag it helpfully spits out the FastCGI environment it got from httpd(8) and what it's planning to do with that.

@pr1ntf
pr1ntf / 9front-yabs.sh
Last active September 5, 2023 21:40
Get 9front (Plan9 fork) booted under FreeBSD bhyve
#!/bin/sh
# Yet Another bhyve Script v0.4
# Use this to try and boot 9front, the Plan9 fork.
# Virtio emulation works better (ported drivers)
# PS/2 Mouse emulation requires updated bhyve(8)
# If you don't have it, patch is uploaded with this Gist
# When partitioning, I have had more success with MBR
# GPT may work for some people
@bsdlme
bsdlme / vagrant-bhyve.md
Last active March 28, 2024 20:20
Setting up vagrant-bhyve on FreeBSD

Using bhyve with vagrant

The following describes how to set up bhyve with Vagrant using the vagrant-bhyve plugin.

Prerequisites

@schmonz
schmonz / gpio.conf
Created August 3, 2016 19:14
NetBSD Raspberry Pi: toggle onboard LED
gpio0 16 set out act_led
@filipechagas
filipechagas / remove-refind.sh
Created May 26, 2016 23:18
Removing REFIND from Mac
# Start on recovery mode
# Go on terminal
$ mount -t msdos /dev/disk0s1 /Volumes/ESP.
$ rm -rf /Volumes/ESP/efi/refind
# from http://www.rodsbooks.com/refind/installing.html#uninstalling
@dannguyen
dannguyen / README.md
Last active December 28, 2023 15:21
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs