Skip to content

Instantly share code, notes, and snippets.

@mmb
mmb / disable.sh
Created August 31, 2024 22:36
Disable "Cyber Security" mode in a Quantum Fiber C5500XK modem
#!/bin/sh
set -eu
MODEM_URL='https://192.168.0.1'
USERNAME='admin'
PASSWORD='your password'
curl \
--cookie-jar cookie \
@mmb
mmb / adlist.txt
Last active December 7, 2024 03:19
adlist.txt
businessinsider.com
cnn.com
drudgereport.com
enduser.adsrvr.org
evenpolitics.com
metafilter.com
news.google.com
niothinker.com
savannahtime.com
temu.com
@mmb
mmb / blackbox.yml
Created December 5, 2021 06:32
Pi-hole blackbox probe to test DNS blocking
modules:
pi-hole-test:
prober: dns
timeout: 5s
dns:
query_name: pagead2.googlesyndication.com
query_type: A
validate_answer_rrs:
fail_if_not_matches_regexp:
- ".*0.0.0.0"
@mmb
mmb / k8s_yaml_stream_parse.go
Created June 25, 2021 20:25
Parse a stream of kubernetes YAML on stdin into objects for reading
package main
import (
"fmt"
"io"
"os"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@mmb
mmb / gist:6a13776534edc055b4371769fa5dd0d9
Created May 19, 2020 06:46
let me know when the internet connection is fixed
ping -o 8.8.8.8 && say 'internet is back'
@mmb
mmb / Makefile
Created September 27, 2018 05:17
Makefile for graphviz
SRCS = $(wildcard *.dot)
PDFS = $(patsubst %.dot,%.pdf,$(SRCS))
PNGS = $(patsubst %.dot,%.png,$(SRCS))
all: pdfs pngs
pdfs: $(PDFS)
pngs: $(PNGS)
@mmb
mmb / unencrypted_objects.rb
Created November 2, 2017 04:39
List objects in an S3 bucket with no server-side encryption
require 'aws-sdk-s3'
client = Aws::S3::Client.new(region: 'us-west-2')
bucket = 'bucket1'
resp = client.list_objects(bucket: bucket)
resp.contents.each do |object|
metadata = client.head_object(bucket: bucket, key: object.key)
puts object.key unless metadata.server_side_encryption
config setup
uniqueids=no
charondebug="enc 0, ike 2, knl 0, net 0"
conn ipsec-10.0.16.1/20
leftcert=instance_certificate.pem
auto=route
keyexchange=ike
esp=aes128gcm16!
type=transport
@mmb
mmb / gist:71a6e8a0a1ebb97c502e
Created December 6, 2015 20:35
javascript current time in beats
<h1 id="time"></h1>
<script>
function toBeats(date) {
return ((date.getTime() / 1000.0) + 3600) % 86400 / 86.4;
}
function formatTime(date) {
return (date.getMonth() + 1) + "/" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes();
}
@mmb
mmb / cf-app-instances.sh
Last active November 14, 2015 05:40
get instance hosts and ports for a Cloud Foundry app
#!/bin/bash
set -eu
APP_NAME=$1
METADATA_URL=$(
cf curl /v2/apps?q=name:$APP_NAME |
jq -r .resources[0].metadata.url
)