Skip to content

Instantly share code, notes, and snippets.

@mmb
mmb / blackbox.yml
Created Dec 5, 2021
Pi-hole blackbox probe to test DNS blocking
View blackbox.yml
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 Sep 29, 2015
creating a route 53 A record pointing to an elastic ip
View cloudformation_a_record_from_eip.json
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"aRecord": {
"Properties": {
"HostedZoneId": {
"Ref": "hostedZone"
},
"Name": "test.mmbtest.com",
"ResourceRecords": [
@mmb
mmb / k8s_yaml_stream_parse.go
Created Jun 25, 2021
Parse a stream of kubernetes YAML on stdin into objects for reading
View k8s_yaml_stream_parse.go
package main
import (
"fmt"
"io"
"os"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@mmb
mmb / gist:a260ccc14b739b73c181
Created Mar 28, 2015
WeeChat python script to print python version and path
View gist:a260ccc14b739b73c181
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 / skype_status.py
Created May 11, 2010
script to change Skype status
View skype_status.py
#!/usr/bin/python
# script to change Skype status, usage: skype_status.py new_status
# Copyright (c) 2010
# Matthew M. Boedicker <matthewm@boedicker.org>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@mmb
mmb / gist:6a13776534edc055b4371769fa5dd0d9
Created May 19, 2020
let me know when the internet connection is fixed
View gist:6a13776534edc055b4371769fa5dd0d9
ping -o 8.8.8.8 && say 'internet is back'
@mmb
mmb / Makefile
Created Sep 27, 2018
Makefile for graphviz
View Makefile
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 Sep 12, 2012
Scripting VM virtual consoles from the host.
View gist:3704738
# 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 Nov 2, 2017
List objects in an S3 bucket with no server-side encryption
View unencrypted_objects.rb
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 Aug 4, 2017
graphite/statsd/grafana setup on new Amazon Linux instance
View graphite_grafana.sh
# 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 \