This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package stream | |
import ( | |
"context" | |
"errors" | |
"io" | |
"strings" | |
"go.uber.org/zap" | |
"google.golang.org/grpc/codes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const disconnectListenerCount = new Map<string, number>() | |
const disconnectListenerCleanup = new Map<string, () => void>() | |
// We want subscribe and cleanup each to only happen once despite | |
// This hook being called multiple times across the app in various components. | |
// So subscribe on the first call and cleanup on the last cleanup call (return from useEffect). | |
const allowDisconnectListener = (key: string) => { | |
// Check if first time before incrementing count | |
const isFirst = !disconnectListenerCount.has(key) | |
const count = disconnectListenerCount.get(key) ?? 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package logger | |
import ( | |
"encoding/json" | |
"fmt" | |
"os" | |
"path" | |
"path/filepath" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/traefik/pihole.yaml | |
http: | |
middlewares: | |
pihole-redirectregex: | |
redirectRegex: | |
regex: /admin/$ | |
replacement: / | |
pihole-addprefix: | |
addPrefix: | |
prefix: /admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Warning! Destructive! | |
# https://rook.io/docs/rook/latest-release/Getting-Started/ceph-teardown/#delete-the-data-on-hosts | |
# Run a rook-ceph-tools daemonset and run this on each node: | |
FDISK_BEFORE=$(fdisk -l); \ | |
DISK="/dev/sda"; \ | |
sgdisk --zap-all $DISK; \ | |
dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Kiosk | |
Wants=graphical.target | |
After=graphical.target | |
[Service] | |
Environment="DISPLAY=:0" | |
Type=simple | |
ExecStart=/bin/bash $HOME/kiosk.sh | |
Restart=on-abort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Micro SD | |
## read | |
sudo hdparm -Tt /dev/mmcblk0 | |
/dev/mmcblk0: | |
Timing cached reads: 2190 MB in 2.00 seconds = 1095.17 MB/sec | |
Timing buffered disk reads: 126 MB in 3.04 seconds = 41.46 MB/sec | |
## write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Setup raspbian lite - no desktop environment or Xorg necessary. Install `fbi`. | |
# 2. Sync files to Pi: | |
rsync -ahP --delete ./slides remote-ssh-host:~ | |
# 3. Append to ~/.profile to run on startup | |
if [[ $(fgconsole 2>/dev/null) == 1 ]]; then | |
fbi -d /dev/fb0 -noverbose -a -t 60 -cachemem 0 $HOME/slides/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
curl -sS 'https://raw.githubusercontent.com/openzfs/zfs/master/META' | awk '$1 == "Linux-Maximum:" { print $2; exit }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install go-task | |
--- | |
version: "3" | |
vars: | |
PROJECT: myproject | |
SECRETS_FILE: sops.env | |
COMPOSE_FILES: | |
sh: find . -type f -iname "compose*.yaml" -exec basename {} ';' | sort -r | |
COMPOSE_FILES_ARGS: -f {{ .COMPOSE_FILES | splitLines | join " -f " }} |
NewerOlder