Skip to content

Instantly share code, notes, and snippets.

View W-Floyd's full-sized avatar

William Floyd W-Floyd

View GitHub Profile
@W-Floyd
W-Floyd / mtu-finder.sh
Last active February 17, 2025 15:57
Find the largest usable MTU and output OpenVPN lines required, useful if your ISP/router blocks ICMP messages
#!/bin/bash
PS4='\033[0;33m+(${BASH_SOURCE}:${LINENO}):\033[0m ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -e
# set -xE -o functrace
# Internal parameters
__mtu_largest_success=0
__mtu_smallest_fail=0
__ping_mtu_byte_offset=-24
class StrategyDashboardDemo {
static async generate(config, hass) {
// Query all data we need. We will make it available to views by storing it in strategy options.
const [areas, devices, entities] = await Promise.all([
hass.callWS({ type: "config/area_registry/list" }),
hass.callWS({ type: "config/device_registry/list" }),
hass.callWS({ type: "config/entity_registry/list" }),
]);
// Each view is based on a strategy so we delay rendering until it's opened
#!/bin/bash
# split-pdf.sh <INPUT.pdf> <END_PAGE>
if [ -d "${1%.*}" ]; then
rm -r "${1%.*}"
fi
mkdir "${1%.*}"
// Include the library
#include <Control_Surface.h>
// Instantiate a MIDI Interface to use
USBMIDI_Interface midi;
// Instantiate an analog multiplexer
CD74HC4051 mux = {
A0, // Analog input pin
{ 2,3, 4} // Address pins S0, S1, S2

Keybase proof

I hereby claim:

  • I am w-floyd on github.
  • I am w_floyd (https://keybase.io/w_floyd) on keybase.
  • I have a public key ASCaZdm18QVkuY7ad9hZ8k9aX9X7DSXxH9svYuUrMGw_3go

To claim this, I am signing this object:

@W-Floyd
W-Floyd / SolidWorks_Spoof.sh
Created September 1, 2018 19:01
Simple script to make a Virtualbox VM hidden enough to install SolidWorks
#!/bin/bash
__get_random_string () {
openssl rand -hex "${1}" | cut -c "1-${1}"
}
__my_vm='W10'
Layout Speed Sent Speed Received
←,↖,↖,↖ 138 Mbits/sec 168 Mbits/sec
←,↖,↖,↑ 113 Mbits/sec 177 Mbits/sec
←,↖,↖,↗ 140 Mbits/sec 211 Mbits/sec
←,↖,↖,→ 131 Mbits/sec 190 Mbits/sec
←,↖,↑,↑ 90.6 Mbits/sec 173 Mbits/sec
←,↖,↑,↗ 142 Mbits/sec 221 Mbits/sec
←,↖,↑,→ 132 Mbits/sec 215 Mbits/sec
←,↖,↗,↗ 83.1 Mbits/sec 171 Mbits/sec
←,↖,↗,→ 89.8 Mbits/sec 191 Mbits/sec
@W-Floyd
W-Floyd / zero_strip.sh
Created April 12, 2018 01:28
A one-liner sed expression to nicely strip leading and trailing 0's from each line of piped input
################################################################################
# ... | __zero_strip
################################################################################
#
# Zero Strip
#
# A one-liner sed expression to nicely strip leading and trailing 0's from each
# line of piped input.
#
# For example:
#!/bin/bash
ask() {
# https://djm.me/ask
local prompt default reply
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
#!/bin/bash
replace_baseplate_circle () {
if ! [ -e "${1}" ]; then
return 1
fi
grep -qE '^ <linearGradient id="linearGradient[0-9]*" x1="1" x2="47" gradientUnits="userSpaceOnUse">$' < "${1}" || return 1