Skip to content

Instantly share code, notes, and snippets.

@trauber
trauber / -
Last active August 29, 2015 14:07
\raggedbottom in LaTeX Preamble fixes random vertical spacing at end of sections.
@trauber
trauber / readme.md
Created September 12, 2015 18:13
Parameterizing Powershell Variables
[CmdletBinding()]
param (
  [string] $Name,
  [int] $Age
)

Write-Host -Object "Hi $Name!","You are $Age years old!";
@trauber
trauber / readme.md
Last active October 12, 2015 03:12
grep-like posh Select-String Pipe

As close to grep as I have found so far:

<some-cmd> | Out-String -Stream | Select-String [options] <some-string>

Select-String's -Context option works pretty well ... so far.

@trauber
trauber / blocknotesplitter.md
Last active July 10, 2019 12:57
#awk #markdown #firefox_addon
@trauber
trauber / store-encrypted-gmail-pass-for-mutt.md
Last active July 10, 2019 12:56
Store Encrypted Gmail Pass in Mutt #e-mail #encryption #password

Create in ~/.mutt/pass with contents:

set my_pass = "password"

Encrypt the file:

@trauber
trauber / readme.md
Created July 4, 2019 18:11
Sending HTML Mail with Mutt
mutt -e 'set content_type=text/html' -s 'subject' recip@host.com < file.html
@trauber
trauber / README.md
Last active July 17, 2019 12:51
#vcard #ex Remove Photos from Vcard with Ex

Remove Photos from Vcards

Good ole ex matches multiple lines very easily.

ex -n test.vcf +'g/PHOTO/,/^$/d' +wq
@trauber
trauber / README.md
Created July 17, 2019 12:34
#ratpoison #screengrab
@trauber
trauber / README.md
Created July 17, 2019 12:40
#gs #pdf QandD Shrink a PDF with GS

QandDShrink a PDF with GS

I imagine mileage may vary on this but I was able to shrink a 15mb PDF to 2.5mb.


$ pdf2ps large.pdf large.ps

$ ps2pdf large.ps small.pdf
@trauber
trauber / jsonphotos.sh
Created July 25, 2019 19:47
Make a JSON List of Photos #json
# Use find and file to crawl for files with mime-type image/jpeg or image/png.
# Awk isolates file names.
# rjgpcom gets comments, if any.
# jo wraps everything up into json for jsongallery.
#
# https://jpmens.net/2016/03/05/a-shell-command-to-create-json-jo
# https://github.com/mariobox/jsongallery