Skip to content

Instantly share code, notes, and snippets.

auburnpub.com
chinaplus.cri.cn
dailymail.co.uk
drudgereport.com
english.cctv.com
english.news.cn
metro.co.uk
nypost.com
pagesix.com
peoplesdaily.pdnews.cn
@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 / cloudformation_a_record_from_eip.json
Created September 29, 2015 06:58
creating a route 53 A record pointing to an elastic ip
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"aRecord": {
"Properties": {
"HostedZoneId": {
"Ref": "hostedZone"
},
"Name": "test.mmbtest.com",
"ResourceRecords": [
@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:a260ccc14b739b73c181
Created March 28, 2015 08:08
WeeChat python script to print python version and path
import sys
import weechat
if weechat.register('test', 'test', 'test', 'test', 'test', 'shutdown', ''):
weechat.prnt('', str(sys.version))
weechat.prnt('', str(sys.path))
@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 / gist:3704738
Created September 12, 2012 06:40
Scripting VM virtual consoles from the host.
# Writing to Linux virtual consoles to simulate user input:
s = "ls\n"
open('/dev/tty1','w') do |f|
s.each_char do { |c| f.ioctl(0x5412, c) }
end
# From the shell:
echo 7 | ruby -e "open('/dev/tty1', 'w') { |o| \$stdin.each_char { |c| o.ioctl(0x5412, c) } }"
@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
@mmb
mmb / graphite_grafana.sh
Last active August 4, 2017 20:06
graphite/statsd/grafana setup on new Amazon Linux instance
# graphite/statsd/grafana setup on new Amazon Linux instance
# add http://graphite/ to grafana as a data source
sudo su
yum update --assumeyes
yum install --assumeyes docker
service docker start
docker \
run \