Skip to content

Instantly share code, notes, and snippets.

View rszamszur's full-sized avatar
✌️
Live like there’s no tomorrow.

Radosław Szamszur rszamszur

✌️
Live like there’s no tomorrow.
  • Here, Now.
  • 00:32 (UTC +01:00)
View GitHub Profile

Graceful shutdown of UDMP via NUT upon power loss

This documents everything I needed to get my Proxmox instance to listen to my Network UPS Tools (NUT) Server and initiate a shutdown script that would shutdown my UDM Pro upon power loss. This is needed as the UDM Pro does not have the ability to listen to a NUT server on it's own (what the hell ubiquiti).

I'm using a Synology NAS as a NUT server, but you can point your NUT client to any supported UPS. It's set to alert any clients subscribed to it when the UPS connected to it is in low battery. This all applies regardless of what machine you have a NUT server on, it does not have to be Synology.

Additionally these install steps were on my Proxmox machine, but these steps will probably work on any Debian GNU/Linux OS with little to no modification. YMMV

High level summary of the steps:

  • Install the NUT client on Proxmox
@r2r-dev
r2r-dev / .bazelrc
Last active March 6, 2024 16:01
java_starlark_repl
build --noenable_bzlmod --java_runtime_version=remotejdk_11
@r2r-dev
r2r-dev / HOWTO.md
Last active April 5, 2022 16:07
quick and dirty lazy /nix/store

Create a lazy /nix/store filesystem using nixfs.py

  1. Grab static nix from https://hydra.nixos.org/build/170454219/download/1/nix and place in the same dir as py script
  2. Install fusepy (on nix: nix-shell -p python3Packages.fusepy)
  3. Ensure your /etc/fuse.conf contains user_allow_other
  4. Create workdirs: mkdir -p $(pwd)/{fakenix,workdir} && mkdir -p $(pwd)/fakenix/nix/store
  5. Mount our fs: python nixfs.py $(pwd)/fakenix $(pwd)/workdir
  6. Run some container image with workdir mounted: docker run -v $(pwd)/workdir/nix:/nix ubuntu:latest
  7. Try running some command, for example: /nix/store/pqpa3glx3iqd0cavslmr0lfkzgq1iias-cowsay-3.03+dfsg2/bin/cowsay thefuck?

@GuillaumeDesforges
GuillaumeDesforges / nixos_python_patch_venv_bins.md
Last active November 22, 2025 10:30
How to: make Python dependencies installed via pip work on NixOS

EDIT: check out fix-python instead, make Python run "as usual" on NixOS!

How to: make Python dependencies installed via pip work on NixOS

The issue

  • You are using NixOS
  • You start working on a Python project
  • You manage the dependencies in a classic Python virtual environment using pip or poetry
@r2r-dev
r2r-dev / bash-anywhere.sh
Last active March 18, 2022 07:19
Bring your own shell together with your script. Stop giving a damn about {zsh, ksh, csh, ash, dash, fish} compatibility and focus on the actual work.
#!/bin/sh -
if [ "$1" != "--wrapped" ]; then
echo "[uw] start"
WD="$(mktemp -d)"
echo "[uw] download deps"
curl -L -s https://github.com/robxu9/bash-static/releases/download/5.1.016-1.2.2/bash-linux-x86_64 \
-o "${WD}/bsh" && chmod +x "${WD}/bsh"
curl -L -s http://landley.net/toybox/downloads/binaries/0.8.6/toybox-x86_64 \
@r2r-dev
r2r-dev / bigquery
Last active May 12, 2022 22:12
query github api for metadata and project structure for given list of repositories. output results as csv, remove repository copies and preview results using fzf
SELECT
files.repo_name
FROM (
SELECT
DISTINCT path,
repo_name,
id
FROM
`bigquery-public-data.github_repos.files`
WHERE
@jonlabelle
jonlabelle / compare_versions.sh
Last active October 6, 2023 19:02
Compare Semver Versions in Bash
#!/usr/bin/env bash
#
# Performs a simple semver comparison of the two arguments.
#
# Original: https://github.com/mritd/shell_scripts/blob/master/version.sh
# Snippet: https://jonlabelle.com/snippets/view/shell/compare-semver-versions-in-bash
# Gist: https://gist.github.com/jonlabelle/6691d740f404b9736116c22195a8d706
#
@cyrenity
cyrenity / k8s-using-talos-in-vms.md
Last active October 24, 2025 08:56
Setup kubernetes cluster using Talos (Lab)

Setup Kubernetes cluster in minutes using Talos

1. Get talosctl

Download and install talosctl binary

wget https://github.com/talos-systems/talos/releases/download/v0.8.1/talosctl-linux-amd64
@se79419ed
se79419ed / glassdoor.txt
Created January 7, 2021 15:39
bookmarklet to remove hardsell overlay from glassdoor.com
javascript:(function(){
document.getElementsByClassName('hardsellOverlay')[0].remove();
document.getElementsByTagName("body")[0].style.overflow = "scroll";
let style = document.createElement('style');
style.innerHTML = `
#LoginModal {
display: none!important;
}
`;
document.head.appendChild(style);
@adisbladis
adisbladis / podman-shell.nix
Last active November 20, 2025 22:49
Use podman within a nix-shell
{ pkgs ? import <nixpkgs> {} }:
let
# To use this shell.nix on NixOS your user needs to be configured as such:
# users.extraUsers.adisbladis = {
# subUidRanges = [{ startUid = 100000; count = 65536; }];
# subGidRanges = [{ startGid = 100000; count = 65536; }];
# };