Skip to content

Instantly share code, notes, and snippets.

@RulerOf
RulerOf / install.sh
Created April 4, 2021 15:41
Install OpenVSwitch with os-net-config on Debian Buster
# Install python3 and OVS
sudo apt install python3-pip openvswitch-switch -y
# Install os-net-config
sudo pip3 install os-net-config
# Create os-net-config file
sudo mkdir -p /etc/os-net-config
sudo touch /etc/os-net-config/config.yaml
@RulerOf
RulerOf / README.md
Last active April 9, 2021 14:26
Provides a bare-minimum configuration to keep Amazon Linux 2 on Lightsail updated if you want it to be a "hands off" setup.

Amazon Linux 2 on Lightsail, Bare Minimum Setup

The idea here is to give a set of "common sense" defaults for running Amazon Linux 2 on Lightsail. These defaults include:

  • Automatic Updates
  • Live Kernel Patching
  • Automatic Reboots when Required by Updates

Usage

@RulerOf
RulerOf / main.py
Created May 7, 2021 02:35
Predictable Shuffle with Python
import random
shuffle_key = "QRUzaKNB4V5pparzJWTa"
# Imagine we have a list of images that's 200k items long
frame_list = [*range(1,200000)]
# Shuffle the frame list with the key
random.Random(shuffle_key).shuffle(frame_list)
@RulerOf
RulerOf / script.sh
Created June 2, 2021 15:44
Dump linux release information
#!/bin/bash
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
@RulerOf
RulerOf / pfsense-on-oracle-linux-7.md
Last active September 13, 2021 04:38
Installing pfSense on KVM in Enterprise Linux 7

Installing pfSense on KVM in Enterprise Linux 7

We download the latest release of pfSense as a gzipped ISO, then extract it and pass it to virt-install to get the VM up and running. Interactive portions of setup are handled with a VNC viewer because the pfSense installer doesn't seem to be able to work with virt-install's native console redirection, at least not out of the box. I'd love a tip from anyone if it's possible to fix that somehow.

CentOS 8 instructions are this way.

Instructions

Find the latest release here.

@RulerOf
RulerOf / fusion-io-on-oracle-linux-7.md
Last active April 11, 2022 17:37
Installing drivers for ioDrive Duo on Oracle Linux 7

Installing drivers for ioDrive Duo on Oracle Linux 7

This process is an outline of the steps I followed to get my two first-gen 640GB ioDrive Duo cards working on Oracle Linux 7. After we install the driver, we're going to perform the optional step of formatting the cards to use native 4k sectors, since it offers marginally better throughput and a decent reduction to memory usage.

Download Driver binary and support tools tarball

Go to the SanDisk support site and download the packages that correspond to your device and kernel. I'm using 64-bit Oracle Linux 7.

On the support site, we pick out our device,

@RulerOf
RulerOf / centos-extras-on-OEL7.md
Last active October 29, 2022 17:17
Adding Centos Extras repo to Oracle Enterprise Linux 7

Adding CentOS Extras to Oracle Enterprise Linux

If you want to install a package like Docker Community Edition on OEL, you'll have to add the CentOS Extras repo, which as of release 7 is built-in to CentOS and not added on later like EPEL is. As a result, instructions for adding it to EL7 are hard to find. This should work for any build of Enterprise Linux that does not already include the CentOS Extras repo. I have absolutely no idea if it's apporpriate to use this repo on a build of Linux other than CentOS, but it should be.

This was tested on Oracle Enterprise Linux 7, but should be copy-pastable on any version or EL build assuming things don't change too much.

Download the CentOS GPG Key

# Get OS Release number
@RulerOf
RulerOf / README.md
Last active November 30, 2022 21:20
Dynamic DNS Script I used for Google Domains with DD-WRT

DD-WRT Dynamic DNS for Google Domains

Create a Synthetic Record for Dynamic DNS. Copy the script and substitute your synthetic record's username, password, and FQDN in the config section.

Go to Administration > Commands tab and paste the code into the Command box, then click Save Custom Script.

Go to Administration > Management tab. Scroll down to the Cron section, and toggle Cron: Enable

In the Additional Cron Scripts section, put:

@RulerOf
RulerOf / README.md
Last active May 3, 2023 18:18
Using a different shell without running `chsh`

Problem

I wanted to create a jumpbox where the default shell was zsh, but I couldn't actually change the default shell of the users that would be connecting to the box. I also wanted to manage some symlinks in the user profile dynamically with Dotbot.

My initial idea was to add a script to /etc/profile.d that would just dump users into /bin/zsh, but this had several different problems, including the all-important question of "But what if I want to run Bash on purpose?"

Solution

Through a little bit of trial and error, I settled on this script located at /etc/profile.d/dotbot.sh

@RulerOf
RulerOf / ec2-exec.sh
Created November 16, 2021 10:05
Synchronously run commands on an SSM-managed EC2 instance
#!/bin/bash
which jq > /dev/null 2>&1
if [ "$?" -ne 0 ]; then
>&2 echo Error: this script requires jq; exit 1
fi
which aws > /dev/null 2>&1
if [ "$?" -ne 0 ]; then
>&2 echo Error: this script requires awscli; exit 1