Skip to content

Instantly share code, notes, and snippets.

@ab
ab / certtest.rb
Created June 8, 2014 02:55
SSL certificate algorithm test
#!/usr/bin/env ruby
require 'socket'
require 'openssl'
def check_ssl_cert(host, port, ca_file)
sock = TCPSocket.new(host, port)
ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params(:verify_mode => OpenSSL::SSL::VERIFY_PEER,
:ca_file => ca_file)
@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'
@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 / 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 / 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 / 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
#!/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'
#!/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
@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
@ab
ab / πŸ’©.rb
Last active November 16, 2020 22:25
#!/usr/bin/env ruby
alias πŸ“„ puts
class AπŸ–₯
@@🐴 = {
πŸ˜‚: 'Hello, world!',
πŸ™ƒ: 'HALP',
πŸ–₯: 'computer.',
}