Skip to content

Instantly share code, notes, and snippets.

View brodygov's full-sized avatar

Andy Brody brodygov

View GitHub Profile
@brodygov
brodygov / cert-import.sh
Created June 15, 2018 21:52
Import certificate authorities into a repo while normalizing their format and finding duplicates
#!/bin/bash
set -eu
usage() {
cat >&2 <<EOM
usage: $(basename "$0") CRT_FILE BASENAME
Import CRT_FILE (in PEM format) into this directory with BASENAME as the
prefix. The output file will be named in this format:
BASENAME.<issue_year>-<exp_year>.<subj_key_id>.<sha1_fingerprint>.crt
EOM
@brodygov
brodygov / s3-split-ls-by-date.go
Created June 21, 2018 22:40
Split s3 file by date
package main
import (
"bufio"
"fmt"
"log"
"os"
"path"
"strings"
"syscall"
@brodygov
brodygov / pkcs11-test.rb
Last active October 29, 2019 17:39
Test of openssl PKCS11 functionality (works with PIV card)
# engine_pkcs11 came from `brew install engine_pkcs11`
require 'tty-prompt'
OpenSSL::Engine.load
pkcs11_engine = OpenSSL::Engine.by_id('dynamic') do |e|
e.ctrl_cmd('SO_PATH', '/usr/local/Cellar/engine_pkcs11/0.1.8/lib/engines/engine_pkcs11.so')
e.ctrl_cmd('ID', 'pkcs11')
e.ctrl_cmd('LIST_ADD', '1')
e.ctrl_cmd('LOAD')
e.ctrl_cmd('PIN', TTY::Prompt.new.ask('PIN:', echo: false))
#!/usr/bin/env python3
import os
import sys
import zipfile
import requests
def main(argv):
@brodygov
brodygov / AB ish.fwt
Created October 12, 2018 18:24
AB Focuswriter theme (gzip the file and rename to .fwtz to import)
[General]
LoadColor=#000000
Name=AB ish
[Background]
Color=#000000
ImageFile=
Type=0
[Foreground]
#!/usr/bin/env ruby
# Copy a list of issues from one repository to another.
require 'date'
require 'yaml'
require 'pp'
require 'json'
require 'rest-client'
@brodygov
brodygov / repo_cloner.rb
Created February 7, 2019 20:31
Ruby code for cloning a repo via SSH to a temporary directory
# frozen_string_literal: true
require 'fileutils'
require 'logger'
require 'tempfile'
require 'tmpdir'
require 'octokit'
require 'subprocess'
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'date'
require 'json'
require 'rest-client'
DefaultStart = '10:30 AM'
#!/bin/bash
set -eu
run() {
echo >&2 "+ $*"
"$@"
}
if [ $# -lt 2 ]; then
cat >&2 <<EOM
#!/bin/bash
set -euo pipefail
usage() {
cat >&2 <<EOM
usage: $(basename "$0") COMMON_NAME
Generate saml certificate and key in the current directory for COMMON_NAME.
For example: