In /etc/nixos/configuration.nix:
services.printing.enable = true;
services.printing.drivers = [ pkgs.hplip ];
services.printing.startWhenNeeded = true; # optional
users.users..extraGroups = [ ... "lp" ... ];
| // get the original destination for the socket when redirect by linux iptables | |
| // refer to https://raw.githubusercontent.com/missdeer/avege/master/src/inbound/redir/redir_iptables.go | |
| // | |
| const ( | |
| SO_ORIGINAL_DST = 80 | |
| IP6T_SO_ORIGINAL_DST = 80 | |
| ) | |
| func getOriginalDst(clientConn *net.TCPConn) (rawaddr []byte, host string, newTCPConn *net.TCPConn, err error) { | |
| if clientConn == nil { |
| #!/bin/sh -e | |
| if [[ $# -ne 1 ]] ; then | |
| cat - <<HELP | |
| usage: $0 <gpg secret key id> | |
| Generates a printable PDF file <gpg secret key id>-backup.pdf for the given key id. | |
| HELP | |
| exit 1 | |
| fi |
| { pkgs }: | |
| { | |
| # fetch docker image content and return path in nix store | |
| # inspired from https://github.com/NixOS/nixpkgs/blob/6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef/pkgs/build-support/docker/default.nix#L264 | |
| fetchDocker = coordinates: | |
| let | |
| name = "${coordinates.finalImageName}-${coordinates.finalImageTag}"; | |
| result = pkgs.dockerTools.runWithOverlay { | |
| name = "docker-exporter-${name}"; |
| #!/bin/bash | |
| # setup wifi | |
| wpa_supplicant -B -i interface -c <(wpa_passphrase 'SSID' 'key') | |
| # partition disks | |
| # sda1 /boot | |
| # sda2 LVM PV | |
| # - vg hdd | |
| # - lv root |
| #!/usr/bin/env bash | |
| set -e | |
| # see https://techdocs.akamai.com/iot-token-access-control/reference/generate-jwt-rsa-keys | |
| PRIVATE_KEY_PEM="$1" | |
| b64encode() { | |
| echo -n "$*" | base64 -w 0 | sed s/\+/-/ | sed -E s/=+$// | |
| } |
A Shelly script to install on Shelly devices to publish MQTT announcement messages for Home Assistant.
![Example screenshot](https://gist.githubusercontent.com/jeremiehuchet/84e8dc96573e37200c2ab3bd4e013729/raw/793e171ba74eb5c3f39e5f58d18b648ba9b16659/screenshot.png
This note explain how to reduce a mounted filesystem on an LVM partition. It requires a reboot but most of the operations can be done online and the system can be used during the operations.
sudo mount -f -o remount,ro /home
sudo lvcreate -s data/home -L 30G -n home_resize
sudo lvdisplay data/home_resize