Skip to content

Instantly share code, notes, and snippets.

nitrag /
Last active Jul 20, 2020
Proxmox VM Utilization + Folding@Home VM Control
import json
import requests
import time
import warnings
from enum import Enum
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from typing import List, Tuple
warnings.filterwarnings('ignore', message='Unverified HTTPS request')
nitrag /
Created Apr 13, 2020
Plex SD to Radarr for Quality Upgrade
# Scans your plex movies, if a movie has only SD quality, it will send it to Radarr
# pip install plexapi
# python 3.6+
from plexapi.server import PlexServer
import re
import requests
plex_url = ''
plex_token = 'abc123'
nitrag /
Last active Mar 31, 2020
Ubuntu 18.04 - K8s install and join cluster
# Enable bridged traffic -
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
sysctl --system
# Enable IP Forward
echo "1" > /proc/sys/net/ipv4/ip_forward
nitrag /
Created Mar 6, 2018
Setup check_mk_agent via systemd on Ubuntu 16.04 (OMD, Check_MK)
# How to install Check MK Agent on ubuntu 16.04
# Install check_mk_agent:
# - sudo apt-get install check-mk-agent (will install older version)
# - On your Check_MK dashboard, go to "Monitoring Agents", click the link for "Check_MK Agent for Linux", save the raw text
# on your server:
sudo vi /usr/bin/check_mk_agent
# paste Check_MK dashboard > Monitoring Agents > Check_MK Agent for Linux
nitrag / gdal_osx_virtualenv
Created Oct 6, 2017
Install GDAL on OSX (virtualenv)
View gdal_osx_virtualenv
# what a headache!
# 10-05-2017
# Install kyngchaos 1.11 complete:
# Go into your folder where your virtualenv lives and activate
source bin/activate
nitrag /
Last active Aug 1, 2021
Audibook convert m4b to mp3. This will split into chaptered mp3 files and automatically reconfigure proper ID3v2 tags.
# sudo apt-get install id3v2 ffmpeg
# cd /book title/
# bash ~/
# rm *.m4b (you need to manually remove the original in case something goes wrong)
nitrag / uploadMapboxTileset.js
Last active Feb 14, 2017
Upload file to Mapbox Tileset (node.js)
View uploadMapboxTileset.js
Uploads a tileset (tested with to Mapbox S3 (required),
then triggers an API request to Mapbox to create/update the tileset
node uploadToMapBoxTileset.js [path/to/] [tilesetId] [Tileset Title]
Pro tip: Don't foget to change {username} and {access_token} and/or hardcode the process.argv[] values.
nitrag / commands.config
Last active May 27, 2020
How to setup GeoDjango on AWS Elastic Beanstalk (EB) with a Custom AMI
View commands.config
command: "sudo yum-config-manager --enable epel"
command: cd /home/ec2-user/gdal-1.11.2/swig/python && /opt/python/run/venv/bin/python install
nitrag / GPSExif.swift
Last active May 25, 2021
Generate Metadata Exif for GPS
View GPSExif.swift
// Generate EXIF GPS metadata
// Swift 3
// Exif Version supports decimal degrees
import Foundation
import CoreLocation
import ImageIO
extension CLLocation {
nitrag / Screenshot.swift
Created Nov 21, 2016
This will allow you to take a screenshot of a UIView, but more importantly only a section of that view
View Screenshot.swift
// Screenshot.swift
// 1) Take a picture of a UIView
// 2) Take a picture of a UIView's subframe. EG. Fullscreen UIView with a
// small square box in the middle, it will only save what's visible in the box frame
// but not the box itself
import Foundation
import UIKit