Skip to content

Instantly share code, notes, and snippets.

Avatar
🦦

Matt Burke spraints

🦦
View GitHub Profile
@spraints
spraints / extract.rb
Created Sep 26, 2022
Extract stream blocks from a PDF
View extract.rb
# Usage: ruby extract.rb PDF...
#
# Extracts all 'stream' blocks from the PDF. This includes all images embedded
# in it. All of the output files have a '.bin' extension. Sometimes you can see
# what they are by doing something like this:
#
# $ ruby extract.rb example.pdf
# $ file *.bin
def main
@spraints
spraints / code.go
Created Apr 26, 2022
Compare locking strategies for generating certs
View code.go
package sharedcertprovider
import (
"context"
"sync"
"time"
)
type Provider interface {
GetCert() Cert
@spraints
spraints / README.md
Created Aug 3, 2012
Set up git-hooks
View README.md

Install git hooks

git-hooks is a tool that makes it easy to re-use hook scripts across projects.

I installed it by cloning the repo and symlinking it into /usr/local/bin.

git clone git://github.com/icefox/git-hooks.git
cd git-hooks
ln -s `pwd`/git-hooks /usr/local/bin/git-hooks
View letter.md

Hello Mr. Baird,

I've been meaning to write for a while, and your recent mailer provided the motivation I needed.

First of all, I'd like to thank you for representing our district. I realize that it takes a significant amount of effort to keep in touch with your district at home and be involved in Washington, too. I also want to thank you for your military service. It's clear that you are dedicated to our country.

The primary thing that I wanted to write to you about is the ongoing COVID-19 pandemic. Frankly, I'm quite discouraged by the lack of control of the spread of the virus, and the lack of any effective effort by the federal government in this area. I think it's good that there has been significant economic relief. But that's a bandaid. I'll repeat what I said in my May email to you: the economy will not recover as long as coronavirus transmission is still happening. Why hasn't the federal government taken the lead on controlling spread? As a member of Congress and as a representative of our distric

View Dockerfile
FROM debian:10.2
# This is needed for 'apt-key add'.
RUN apt-get update && apt-get install -y gnupg
COPY zerotier.list /etc/apt/sources.list.d/zerotier.list
COPY zerotier.key /tmp/zerotier.key
RUN apt-key add /tmp/zerotier.key
RUN apt-get update && apt-get install -y zerotier-one
View letter.md

Hi Jim,

I'm writing about COVID-19. First of all, thank you for voting for the CARES Act in March. I think it's a necessary step towards getting the pandemic under control.

My main point in writing, though, is that I am extremely disappointed in the response of the federal government to the pandemic. There seems to be a lot of focus on the economic effects of the crisis. The economic effects are quite bad. But I think a lot of the emphasis on the economy is misplaced. Regardless of the official restrictions on activity, the economy will not recover as long as coronavirus transmission is still happening. Instead of focusing on re-opening the economy, we, as a nation, should be focused on eliminating the virus. When the threat of infection is gone, the economy will take care of itself.

States, including Indiana, are taking cues from the federal government. I think that Indiana is opening too soon, in large part because of the lack of strong leadership from the federal government. Please support measures that

@spraints
spraints / bigfiles.md
Created Sep 20, 2019
track down large files in your repo's history
View bigfiles.md

First, get a list of all objects with their sizes.

git rev-list --all --objects | awk '{print $1}' | git cat-file --batch-check > obj-sizes.txt

Show the largest object size.

cat obj-sizes.txt | awk '{print $3}' | sort -n | tail -1
View gr.rb
def show(x, y)
puts "#{y} #{y.to_f / x.to_f}"
end
a, b = ARGV.map(&:to_i)
c = a + b
puts a
show a, b
show b, c
50.times do
@spraints
spraints / add_putty_host.bat
Created Mar 18, 2010
Creates registry entries for a saved putty session with a window 80x40 and the ssh agent forwarded.
View add_putty_host.bat
@echo off
setlocal
set alias=%1
set host=%2
set user=%3
if "" == "%alias%" goto :help
if "" == "%host%" set host=%alias%
if "" == "%user%" set user=%USERNAME%
rem echo Host: %host%
rem echo User: %user%