Skip to content

Instantly share code, notes, and snippets.

View ab's full-sized avatar

Andy Brody ab

View GitHub Profile
@ab
ab / github-print-bookmarklet.js
Last active October 19, 2016 02:39
Github Print Bookmarklet (like others, but does not require jQuery). Paste the minified javascript: into a bookmark to use it.
/* Remove stuff from the page to make github pages pretty for printing */
console.log("Github pretty print 0.1");
function removeClassElems(name) {
console.log("looking for class:", name);
Array.from(document.getElementsByClassName(name)).forEach(function(e) {
console.log("Removing", e);
e.parentNode.removeChild(e);
});
@ab
ab / 💩.rb
Last active November 16, 2020 22:25
#!/usr/bin/env ruby
alias 📄 puts
class A🖥
@@🐴 = {
😂: 'Hello, world!',
🙃: 'HALP',
🖥: 'computer.',
}
@ab
ab / cut-month.sh
Created December 15, 2015 11:17
Glue scripts for cutting together time lapse video
#!/bin/bash
set -eu
if [ $# -ne 3 ]; then
cat >&2 <<EOM
usage: $(basename "$0") YEAR MONTH {high|low|concat-only}
EOM
exit 1
fi
#!/usr/bin/env bash
#
# Syncs Ruby binstubs for ruby-communal-gems.
# Run this everytime you install a new Ruby, or when you install a new gem
# with a bin/ command. (ie, when you typically do rbenv rehash)
#
# See: https://github.com/tpope/rbenv-communal-gems/issues/5
#
set -eu
#!/usr/bin/env python
import imaplib
import os
import logging
import optparse
# LABEL = 'support'
# QUERY = 'before:2015-06-01 -label:to-delete'
# DEST = 'to-delete'
LABEL = 'to-delete'
@ab
ab / AA_dmarc.rb_MOVED.md
Last active August 11, 2020 22:06
DMARC analysis: some hacks to look at DMARC vendors. MOVED TO https://github.com/ab/dmarc-analysis
@ab
ab / ciphers.rb
Created November 18, 2014 04:32
SSL cipher test
#!/usr/bin/env ruby
require 'openssl'
require 'socket'
METHODS = OpenSSL::SSL::SSLContext::METHODS.select {|m| (m.to_s =~ /_(client|server)$/).nil?}
PORT = 443
HOST = ARGV[0] || 'qa.stripe.com'
IN_BUFFER = []
OUT_BUFFER = []
@ab
ab / autossh-ab.conf
Created November 18, 2014 04:23
Persistent SSH reverse port forward
description "autossh tunnel to HOST"
author "Andy Brody"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [016]
respawn
respawn limit unlimited
setuid tunnel
@ab
ab / comment-hosts.sh
Created October 20, 2014 23:49
Modify /etc/hosts by adding or removing comments from lines by IP address.
#!/bin/sh
# 1.0
set -eu
HOSTS=/etc/hosts
usage() {
cat <<EOM
usage: $(basename "$0") OPTION...
Modify /etc/hosts by adding or removing comments from lines by IP address.
@ab
ab / test.sh
Created September 4, 2014 23:05
set -e nonsense
#!/bin/bash
set -e
false() {
echo 'this is false'
command false
}
echo 'starting'