Skip to content

Instantly share code, notes, and snippets.

View ab's full-sized avatar

Andy Brody ab

View GitHub Profile
#!/bin/sh
set -eux
first_next_month="$(date -d "+1 month - $(date +%d) days + 1 day" +%A)"
/usr/sbin/sendmail -t <<END
From: Me <me@example.com>
To: Alice <alice@example.com>, Bob <bob@example.com>
Bcc: Me <me@example.com>
Subject: Reminder: rent is due $first_next_month EOM
@ab
ab / keybase.md
Created April 16, 2014 04:45
Keybase proof

Keybase proof

I hereby claim:

  • I am ab on github.
  • I am agb (https://keybase.io/agb) on keybase.
  • I have a public key whose fingerprint is 67B4 E575 99FC 7217 0C8C FAEE C709 0B1A 5F57 CDC5

To claim this, I am signing this object:

@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 / GPL.md
Created September 19, 2011 22:41 — forked from jnrbsn/GPL.md
A Markdown-formatted GPL for your GitHub projects.

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

@ab
ab / testserver.rb
Created October 13, 2011 01:54
A simple test eventmachine server
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
class Server < EM::Connection
def post_init
puts "Someone connected"
send_data "Hello!\n"
end
@ab
ab / level01-date
Created March 19, 2012 21:05
Exploit code for the 2012 Stripe CTF Challenge https://stripe.com/blog/capture-the-flag
#!/bin/sh
cat /home/level02/.password