Skip to content

Instantly share code, notes, and snippets.

View wastrachan's full-sized avatar

Winston Astrachan wastrachan

View GitHub Profile
@wastrachan
wastrachan / init.sh
Last active February 4, 2024 14:47
Git hooks for a repository with git-secret
#!/bin/sh
# Check for required project dependencies and install
# git hooks bundled with this project
echo ""
echo "Checking dependencies..."
if [ -z "$(command -v git-secret)" ]; then
cat <<\EOF
@wastrachan
wastrachan / django_env.py
Created February 3, 2022 17:18
Django Environment Variables
import os
from django.core.exceptions import ImproperlyConfigured
from distutils.util import strtobool
def get_env(var_name, default=None, is_bool=False, is_int=False, is_float=False, is_list=False, is_required=False):
""" Loads a value from the environment variable <var_name> and returns
that value, optionally explicitly cast as a type.
If the environment variable is not set, return <default>.
@wastrachan
wastrachan / er_upgrade_wg.sh
Last active December 11, 2022 18:29
Edgerouter Upgrade Steps
#### Make sure install-pkgs is present in /config/scripts/pre-config.d/install-pkgs
#### Pre-Upgrade
mkdir -p /config/data/firstboot/install-packages/
cd /config/data/firstboot/install-packages/
curl -OL <https://github.com/WireGuard/wireguard-vyatta-ubnt/releases>
#### Upgrade
add system image <https://www.ui.com/download/edgemax/edgerouter-4>
sudo reboot
@wastrachan
wastrachan / wg0.nmconnection
Last active November 1, 2020 02:46
Wireguard Configuration for NetworkManager
# Wireguard Configuration for NetworkManager
#
# sudo vim /etc/NetworkManager/system-connections/wg0.nmconnection
# sudo chmod 0600 /etc/NetworkManager/system-connections/wg0.nmconnection
# sudo nmcli connection reload
#
[connection]
id=home.rew1red.com
type=wireguard
@wastrachan
wastrachan / arch.md
Last active September 30, 2022 03:33
Arch utilities and modifications

Arch Linux

Packages

System Packages

  • yay-bin - AUR / Pacman helper
  • downgrade - Pacman package downgrade helper
  • kernel-modules-hook - Prevent kernel mods from breaking on kernel upgrade
  • systemd-boot-pacman-hook - Update systemd entry on systemd-boot upgrade
  • bolt - Utility to manage/trust thunderbolt accessories without udevd rules
  • reflector - Updated mirrorlist
/**
* Switchboard LED Flasher
* Created for Teensy 3.2
* Copyright (c) Winston Astrachan 2019
*
* Emulates a telephone switchboard with 8 lights, blinking them
* to simulate incoming calls at psuedo-random intervals.
*/
const int LAMP1 = 9;
#! /bin/bash
#
# APT Installed
# Compare currently installed packages with archived package list
#
# (c) Winston Astrachan 2019
ARCHIVE_FILE=/etc/apt/basepackages.txt
#!/usr/bin/env python3
import datetime
import shutil
import os
import sys
if not len(sys.argv) > 1:
print("Expects path to F1 episode as first argument")
quit(1)
@wastrachan
wastrachan / config.yml
Last active May 6, 2019 02:06
F1 FlexGet Config
variables: variables.yml
schedules:
- tasks: '*'
interval:
minutes: 5
templates:
deluge:
deluge:
@wastrachan
wastrachan / openvpn-in-lxd.txt
Last active March 21, 2023 13:07
OpenVPN in LXD Container
# On the host
=============
lxc config set openvpn raw.lxc 'lxc.cgroup.devices.allow = c 10:200 rwm'
lxc config device add openvpn tun unix-char path=/dev/net/tun
# In the container
==================
1. mknod /dev/net/tun c 10 200