Skip to content

Instantly share code, notes, and snippets.

@pgeraghty
pgeraghty / settings.json
Created June 26, 2020 11:57
VS Code Settings - per-project shell history
{
"terminal.integrated.env.linux": {
"PROMPT_COMMAND": "history -a",
"HISTFILE":"${workspaceFolder}/.sh_history"
}
}
@pgeraghty
pgeraghty / shrink.sh
Created September 8, 2021 22:29
PDF shrink with Ghostscript
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \
-dNOPAUSE -dBATCH -dColorImageResolution=150 \
-sOutputFile=output.pdf original.pdf
@pgeraghty
pgeraghty / outlook_emails.rb
Last active May 2, 2024 12:08
Open Outlook email attachments with Ruby
# NB: Attachment#save seems to produce 0 byte files, probably would be resolved via rewind below
require 'mapi/msg'
msg = Mapi::Msg.open '/tmp/email.msg'
# view body
puts msg.properties.body
# save attachments
msg.attachments.each_with_index do |a, idx|