Skip to content

Instantly share code, notes, and snippets.

@MatthaeusHarris
MatthaeusHarris / rpki.sh
Created May 17, 2022 22:59
Generate and sign an ARIN RPKI ROA locally
#!/bin/bash
### Configuration details
# Your ARIN-issued certificate here:
CERT=ARIN-UL-348-2022-05-17.cer
# Your private key here
PRIVKEY=uberduck_rpki.pem
# The name of this RPKI ROA
NAME=Uberduck
$ ipython3
/home/mharris/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py:931: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
warn("Attempting to work in a virtualenv. If you encounter problems, please "
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.7.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: a: 5
In [2]: a
@MatthaeusHarris
MatthaeusHarris / setup.yaml
Created March 26, 2020 18:39
Mattflix setup
---
- name: Update all packages
hosts: all
tasks:
- name: Update all packages
package:
name: "*"
state: latest
- name: Setup NFS Mounts
@MatthaeusHarris
MatthaeusHarris / login.py
Created December 20, 2019 20:48
Python3 script to stay logged in to a captive portal wifi network with a very short timeout
#!/usr/bin/env python3
# pip3 install selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
import time
@MatthaeusHarris
MatthaeusHarris / function_pointer_array.c
Created October 5, 2019 21:24
Quick and dirty state machine with function pointers in C
#include <stdio.h>
// Declare three functions that return nothing and accept a single pointer to an int as an argument
void state1(int *);
void state2(int *);
void state3(int *);
// Set up our state definitions. Using bare numbers in code itself is an anti-pattern.
const int STATE_1 = 0;
const int STATE_2 = 1;
@MatthaeusHarris
MatthaeusHarris / Makefile
Created February 18, 2019 02:48
Non-working makefile (compiles, but code does not run on microcontroller)
PRG = binaryclock
MCU_TARGET = atmega328p
PROGRAMMER = usbtiny
PFLAGS = #-P /dev/ttyUSB0
OPTIMIZE = -Os
DEFS = -DF_CPU=1000000UL
LIBS =
HEADERS =
@MatthaeusHarris
MatthaeusHarris / Makefile
Created February 18, 2019 02:48
Non-working makefile (compiles, but code does not run on microcontroller)
PRG = binaryclock
MCU_TARGET = atmega328p
PROGRAMMER = usbtiny
PFLAGS = #-P /dev/ttyUSB0
OPTIMIZE = -Os
DEFS = -DF_CPU=1000000UL
LIBS =
HEADERS =
@MatthaeusHarris
MatthaeusHarris / Makefile
Created February 18, 2019 02:46
Working, hack-ish makefile
PRG = binaryclock
MCU_TARGET = atmega328p
PROGRAMMER = usbtiny
PFLAGS = #-P /dev/ttyUSB0
OPTIMIZE = -Os
DEFS = -DF_CPU=1000000UL
LIBS =
HEADERS =
def hsv2rgb(h,s,v):
"""
0 <= h < 360 # Hue
0 <= s <= 255 # Saturation
0 <= v <= 255 # Value
Hue: position on the color wheel (0 is red)
Saturation: How much of the color is present
Value: How bright the resultant color is
def hsv2rgb(h,s,v):
"""
0 <= h < 360 # Hue
0 <= s <= 255 # Saturation
0 <= v <= 255 # Value
Hue: position on the color wheel (0 is red)
Saturation: How much of the color is present
Value: How bright the resultant color is