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:
@benders
benders / index-usage.sql
Created May 19, 2009 18:31 — forked from gnarg/gist:114268
Finds unused indexes in a mysql database
// Finds unused indexes in a mysql database
SELECT
t.TABLE_SCHEMA,
t.TABLE_NAME,
s.INDEX_NAME,
s.COLUMN_NAME,
s.SEQ_IN_INDEX,
( SELECT MAX(SEQ_IN_INDEX)
FROM INFORMATION_SCHEMA.STATISTICS s2
@benders
benders / chef-nrsysmond.rb
Created November 8, 2011 18:54
Simple New Relic server monitoring recipe for Chef
#
# Thanks to Eron Nicholson at 37 Signals for providing this,
# send thanks to him and blame to me. -Nic Benders
#
template "/etc/apt/sources.list.d/newrelic.list" do
source "newrelic.list.erb"
owner "root"
group "root"
mode 0640

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"
@benders
benders / cisco-asa-config.txt
Last active November 23, 2021 05:01
Getting Amazon VPC up and running with Cisco ASAs can be a pain. This is the config that we used to make it work.
! --------------------------------------------------------------------------------
! This example configuration shows what WE did to get Amazon VPC working with our
! ASAs. We use version 8.3(1). This config has not been reviewed or otherwise
! blessed in any way by anyone at Amazon. YMMV.
!
! It differs from Amazon's supplied config by using two different sets of
! crypto maps and ACLs, so it brings both tunnels up simultaneously.
!
! For the purposes of the example, the physical datacenter network is 172.16.1.0/24
! and the VPC is 10.0.0.0/16.
@benders
benders / All-Down-503.tcl
Created June 17, 2011 18:58
F5 BigIP iRules
when LB_FAILED {
HTTP::respond 503 content "System down for maintenance" noserver "Connection" "close"
}
@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 / .gitconfig
Created August 23, 2010 23:50
A Basic .gitconfig file
[user]
name = Your Name
email = username@newrelic.com
[github]
user = github_user_name
token = XXXXXXXXXXXXXXXXXXXXXXXXX
[color]
status = auto
diff = auto
branch = auto