Skip to content

Instantly share code, notes, and snippets.

@benders
benders / docker-compose.yml
Created April 15, 2024 15:57
Minecraft Server
version: "3.8"
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:

Upgrading OpenWRT on the DFRobot CM4 IoT Router Carrier Board Mini

The CM4 IoT Router Carrier Board Mini is a great little board, easily capable of handling gigabit routing with OpenWRT. But the stock Raspberry Pi images from OpenWRT won't work, because an additional driver is needed for the second network interface. Luckily, the OpenWRT team has made it very easy to build custom images.

Go to the OpenWRT Firmware Selector, choose the Raspberry Pi 4B/400/4CM (64bit) model, then open the twist-out to "Customize installed packages"

Add these packages:

bcm27xx-userland brcmfmac-firmware-usb kmod-brcmutil kmod-cfg80211 kmod-r8169 kmod-usb-dwc2 r8169-firmware
@benders
benders / rendezvous-hashing-demo.rb
Last active October 12, 2022 19:57
A simple example to show how Rendezvous Hashing maintains minimal disruption even when targets change
#!/usr/bin/env ruby
#
# Demonstrate a simple Rendezvous Hash, which is a form of distributed hash
# which allows clients to consistently map resources to a set of "sites",
# and remap them if a site is removed, without having to change the mapping
# for any resources on other sites.
#
# Example output:
#
# Add to .profile / .zprofile
# Requires 1Password CLI v2 https://app-updates.agilebits.com/product_history/CLI2
# To setup: op account add
#
# Change ITEM to choose where 1Password looks
#
op-clip-okta() {
ITEM="Okta"
echo "Fetching ${ITEM} OTP from 1Password"
#include <FastLED.h>
#include <MicroView.h>
#include <RBD_Timer.h>
#include <RBD_Button.h>
FASTLED_USING_NAMESPACE
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
@benders
benders / squid.conf
Last active March 26, 2017 05:03
QNAP squid.conf
# The user name and group name Squid will operate as
cache_effective_user httpdusr
cache_effective_group everyone
#
# Recommended minimum configuration:
#
# Auth Method
#auth_param basic program /share/MD0_DATA/.qpkg/Squid/opt/libexec/squid/ncsa_auth /etc/shadow
#auth_param basic children 5
@benders
benders / iscsi-removal.txt
Created January 17, 2014 07:05
isci removal example
df ; echo ; pvs
vgchange --available n VolGroupBackUps
multipath -ll
multipath -f mpath2
/etc/init.d/multipathd stop
chkconfig multipathd off
iscsiadm -m node
#!/bin/bash
set -ex
wget -O /etc/apt/sources.list https://gist.github.com/benders/8426266/raw/b4969acb524ba727b64cf8eaee7a6a31be8ae6fb/precise-sources.list
apt-get update
wget -O /tmp/pe3-install.sh https://gist.github.com/benders/8426266/raw/b1d4c9b6ea41839b74842f05f2ae9efba7a10394/ubuntu-pe-3-install.sh
@benders
benders / delayed_job_classifier.sql
Last active December 27, 2015 12:59
Figure out WTF is in our delayed_job queue
SELECT
count(*) as count, priority, object, method from (
SELECT
@load_start := LOCATE('object: LOAD;', handler),
@method_start := LOCATE('method: ', handler) + 9,
@method_end := LOCATE('args:', handler) - 1,
IF(@load_start,
@object_start := @load_start + 13,
@object_start := LOCATE('object: !ruby/object:', handler) + 21
),
@benders
benders / config.ru
Created October 19, 2013 06:57
Get some New Relic on a Puppet Master server (version 2.7)
# Oh ho ho, let's see if we can have some fun with the Ruby Agent - Nic 2013-10-18
require 'rubygems'
require 'newrelic_rpm'
require 'new_relic/agent/instrumentation/rack'
# END monkey-business
# A "config.ru", for use with every Rack-compatible webserver.
# SSL needs to be handled outside this, though.
$0 = "master"