Skip to content

Instantly share code, notes, and snippets.

View mallendeo's full-sized avatar

Mauricio Allende mallendeo

View GitHub Profile
@mallendeo
mallendeo / zfs-pve-guide.md
Last active August 30, 2026 02:56
Encrypted ZFS on Proxmox

ZFS on Proxmox: build, encrypt, mount, verify

A working reference for building a Proxmox VE host on ZFS with native encryption, handing datasets to unprivileged containers, and not losing data to the failure modes that do not announce themselves.

Written to be handed to an agent as implementation context. Every rule has a symptom, a cause and a check, so it can be verified rather than trusted. Commands are for OpenZFS 2.2+ on PVE 8/9.

@mallendeo
mallendeo / .zsh_plugins.txt
Last active March 25, 2024 00:28
ZSH + Antidote + Powerlevel10k
rupa/z
ohmyzsh/ohmyzsh path:lib
ohmyzsh/ohmyzsh path:plugins/git
ohmyzsh/ohmyzsh path:plugins/command-not-found
ohmyzsh/ohmyzsh path:plugins/extract
#spaceship-prompt/spaceship-prompt
#sindresorhus/pure
romkatv/powerlevel10k
@mallendeo
mallendeo / README.md
Last active March 29, 2024 20:34
smartctl support for USB QNAP TR-004

smartctl support for USB QNAP TR-004

TLDR

# run as root
for f in smartctl smartctl.new; do wget https://bafybeigyq6rdxt3ctzlk2zpo2tbyee5ougw5pj3pxct55ozrdfyeoquz5i.ipfs.w3s.link/$f -O /usr/sbin/$f; chmod +x /usr/sbin/$f; done

@mallendeo
mallendeo / compose.yml
Last active February 8, 2024 00:35
Cloudflared docker compose
version: '3.3'
services:
cloudflared:
container_name: cloudflared
image: 'cloudflare/cloudflared:latest'
command: 'tunnel --no-autoupdate run --token ${CF_TUNNEL_TOKEN}'
restart: 'unless-stopped'
networks:
- apps
env_file:
@mallendeo
mallendeo / reverse-proxy.js
Last active December 28, 2023 06:51
NodeJS reverse proxy with websocket support
import express from 'express'
import { createProxyMiddleware } from 'http-proxy-middleware'
const PORT = process.env.PORT || 8000
const app = express();
app.use(
'/',
createProxyMiddleware({
@mallendeo
mallendeo / luksunlockusb.sh
Last active November 25, 2023 21:14
Unlock LUKS using attached USB dongle at boot
# /bin/luksunlockusb
#
# Add to /etc/initramfs-tools/modules
# usb-storage
#
# Add key:
# sudo cryptsetup luksAddKey /dev/sdb /home/user/.crypt_file
#
# Edit /etc/crypttab
# nvr_luks UUID=xxxxxxxxxxxx /home/user/.crypt_file luks
@mallendeo
mallendeo / jwt.ts
Created October 4, 2023 15:22
Sign JWT using Jose
import * as jose from 'jose'
const JWT_SECRET = new TextEncoder().encode(ENV.JWT_SECRET)
export const signJWT = async (
data: Record<any, any>,
opts?: {
iat?: number
exp?: string | number
},
@mallendeo
mallendeo / Dockerfile
Last active July 16, 2023 03:22
WhatsApp To MQTT
FROM node:20-alpine
ENV NPM_CONFIG_LOGLEVEL info
RUN apk update && apk add wget git unzip
USER node
WORKDIR /home/node
RUN wget -O app.zip https://codeload.github.com/gist/6de0f9f1eb9370117bd30d7814771974/zip/54b6c6d68949fd46968be4f9833cfcca67a8a349
RUN unzip app.zip -d tmp
@mallendeo
mallendeo / .gitignore
Created March 25, 2023 16:48
ESPHome config
/.esphome/
/secrets.yaml
@mallendeo
mallendeo / update.js
Last active March 3, 2023 00:57
Update all NGINX Proxy Manager hosts at once
// Run this on the browser dev console of nginx proxy manager
{
const wait = (t = 1000) => new Promise(r => setTimeout(r, t))
const rows = document.querySelectorAll('tbody tr')
const update = async () => {
await wait()
document.querySelector('#modal-dialog .btn.save').click()
await wait()
}