Skip to content

Instantly share code, notes, and snippets.

@nmaggioni
nmaggioni / gcode_dimensions.py
Created November 1, 2020 21:29
Get the max/avg XYZ dimensions of a bunch of GCODE files
#!/usr/bin/env python3
# Inspired by @leadgtr7 (https://github.com/buildbotics/bbctrl-firmware/issues/235#issuecomment-580387955)
import glob
def average(lst):
return sum(lst) / len(lst)
@nmaggioni
nmaggioni / rates_from_dvr.py
Last active March 1, 2020 13:17
A simple pitch/roll/yaw rates calculator based on DVR frames count, useful for when you cannot record blackbox logs.
#! /usr/bin/env python
"""
A simple pitch/roll/yaw rates calculator based on DVR frames count, useful for when you cannot record blackbox logs.
Usage: record a DVR of your aircraft doing a few flips/rolls in each axis, and then count how many frames it took to execute the maneuver and turn back level/straight.
"""
from math import ceil
from os.path import isfile
from statistics import mean
@nmaggioni
nmaggioni / pve_lxc_top_mem.sh
Created February 11, 2020 14:57
List Proxmox LXC containers by memory usage
#!/bin/bash
TMPFILE="$(mktemp)"
PCTLIST="$(pct list | grep running | awk '{ print $1 }')"
PCTCOUNT="$(echo $PCTLIST | wc -w)"
i=0;
for id in $PCTLIST; do
i=$((i+1))
echo -ne "Analyzing $i/$PCTCOUNT...\r"
@nmaggioni
nmaggioni / ufw_plex.md
Last active April 23, 2024 19:54 — forked from andrey-str/ufw plexmediaserver app profile.md
Plex Media Server UFW rule

/etc/ufw/applications.d/plexmediaserver

[plexmediaserver]
title=Plex Media Server (Standard)
description=The Plex Media Server
ports=32400/tcp|3005/tcp|5353/udp|8324/tcp|32410:32414/udp

[plexmediaserver-dlna]
title=Plex Media Server (DLNA)
description=The Plex Media Server (additional DLNA capability only)
@nmaggioni
nmaggioni / pre-push.sh
Last active August 14, 2020 16:53 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@nmaggioni
nmaggioni / openpgp.txt
Created January 12, 2016 13:25
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:a6415c8b73a9fdc4865c1bc34874b0c841e33264]
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>