Skip to content

Instantly share code, notes, and snippets.

View pletch's full-sized avatar

Tim pletch

  • Carmel, IN
View GitHub Profile
@LXGaming
LXGaming / Caddyfile
Last active May 31, 2024 19:51
Caddy - Invert Request Matcher
(negate) {
# Set the initial values
vars {args.0} false
vars {args.1} true
# On match invert the values
vars @{args.0} {args.0} true
vars @{args.0} {args.1} false
# Create the inverse matcher
@Vincent-Stragier
Vincent-Stragier / tutorial.md
Last active August 18, 2024 07:58 — forked from crundberg/gist:a77b22de856e92a7e14c81f40e7a74bd
Setup USB (COM port) pass-through on unprivileged Proxmox container

Setup USB (COM port) pass-through on unprivileged Proxmox container

Preparation on host

First find your USB device with lsusb and note the ID. Here, the USB device is the Arduino SA Uno R3 (CDC ACM). The vendor is 2341 and the product is 0041.

root@home:~# lsusb
Bus 003 Device 003: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 003 Device 002: ID 0438:7900 Advanced Micro Devices, Inc. Root Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
@sajalshres
sajalshres / deadsnakes-python39-ubuntu-bionic.md
Created August 13, 2021 08:49
Deadsnakes python 3.9 on Ubuntu 18.04 LTS

Deadsnakes python 3.9 on Ubuntu 18.04 LTS

The deadsnakes PPA make the latest stable versions of python available on Ubuntu 18.04 LTS (3.9 is already in the official apt repo for 20.04). I now find it preferable to installing from source.

The following was tested on a Ubuntu 18.04.5 LTS desktop with python 3.6.9 as the system python version ("python3").

The latest python available from deadsnakes as of July, 2021 is 3.9.6.

Installation Procedure

@lfdominguez
lfdominguez / rate_to_influx.sh
Last active June 28, 2023 14:15
Send traffics stats by ip from pfsense to influxdb
#!/bin/sh
#
# Author: Luis Felipe Domínguez Vega <[email protected]>
#
# Program to use with the rate software to send to InfluxDB the
# rate of each IP on interface
#
# rate_to_influx <influxdb_url> <influxdb_database> <local_network> <interface>
# rate_to_influx http://127.0.0.1:8086 network 192.168.0.0/24 re1
# Code adapted from Tensorflow Object Detection Framework
# https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb
# Tensorflow Object Detection Detector
import numpy as np
import tensorflow as tf
import cv2
import time
@nshtg
nshtg / nginx_libressl.sh
Last active September 11, 2024 06:29
Build nginx statically against modern OpenSSL/LibreSSL
#!/usr/bin/env bash
set -e
# names of latest versions of each package
export NGINX_VERSION=1.13.5
export VERSION_ZLIB=zlib-1.2.11
export VERSION_PCRE=pcre-8.41
export VERSION_LIBRESSL=libressl-2.6.1
export VERSION_NGINX=nginx-$NGINX_VERSION
@pletch
pletch / scrape_pfsense_dhcp_leases.py
Last active April 12, 2024 03:02
Scrape PFSense DHCP Leases Status Page and Export Results to JSON
#!/usr/bin/env python3
# # This python script provides a function to query the pfsense (+v2.4) dhcp leases status page and return a list of tuples including
# ip, hostname, and mac address. To use, ensure LXML is installed via package manager or via pip.
#
# 16-Dec-2016 - Original release
# 3-Sep-2020 - Minor update to match formatting of leases page in latest pfSense version (2.4.5).
# 9-Sep-2020 - Backported improvements to handle table rows with missing data, use global variables for user/pass/server_ip,
# and return list from scrape function as implemented by fryguy04 in fork here:
# https://gist.github.com/fryguy04/7d12b789260c47c571f42e5bc733a813
@pletch
pletch / get_pfqueue_data.sh
Last active September 9, 2020 16:43
Scrape pf QOS metrics for forwarding to InfluxDB
#!/bin/sh
#
# Shell script: get_pfqueue_data.sh
# Date: 21-Dec-2016
#
# Script to scrape queue metrics from pfctl
# and output in influxdb line protocol with interface name &
# q name as tags and q bytes & q drops as data.
#
# Copy this script to a directory on your pfsense machine and ensure