Skip to content

Instantly share code, notes, and snippets.

View akiellor's full-sized avatar

Andrew Kiellor akiellor

View GitHub Profile

Keybase proof

I hereby claim:

  • I am akiellor on github.
  • I am akiellor (https://keybase.io/akiellor) on keybase.
  • I have a public key ASAapijc2AXhZDL-pfVbgWFs-uNQcTS8vsLleuOWq3LnBwo

To claim this, I am signing this object:

@akiellor
akiellor / Dockerfile.flowtype-dev
Last active March 1, 2018 02:46
Flow performance degradation bisect scripts
FROM ubuntu
WORKDIR /data
RUN apt-get update -y
RUN apt-get install -y git opam m4
RUN yes | opam init --comp 4.03.0
RUN git clone https://github.com/facebook/flow.git /data
RUN yes | opam update
RUN yes | opam pin add -n flowtype .
reader = PDF::Reader.new('some.pdf')
filename = "transactions.csv" # obtain this from the XFA in the pdf
page = reader.pages.first
attachment_name_reference = page.objects.find do |k, v|
page.objects.obj_type(k) == :Hash && v[:Type] == :Filespec && v[:UF] == filename }.first
end
attachment_content_reference = page.objects[attachment_name_reference][:EF][:F]
attachment_content = page.objects[attachment_content_reference].unfiltered_data
a b c
1 2 3