Skip to content

Instantly share code, notes, and snippets.

View arnaudlimbourg's full-sized avatar

Arnaud Limbourg arnaudlimbourg

View GitHub Profile
@arnaudlimbourg
arnaudlimbourg / compress-pdf-with-gs.md
Created November 17, 2015 14:31 — forked from guifromrio/compress-pdf-with-gs.md
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#ed4a4a",
"@brand-success": "#5cb85c",
@arnaudlimbourg
arnaudlimbourg / pre-commit.sh
Last active October 13, 2015 22:38
Pre commit hook for python projects
#!/bin/sh
CHANGED=`git diff --cached --name-only --diff-filter=ACM | grep ".py"`
if [ -z "$CHANGED" ]; then
exit 0
fi
# run tests
# TESTS=`py.test ferpection`
# if [ $TESTS -ne 0 ]; then
# echo "your tests failed"
@arnaudlimbourg
arnaudlimbourg / vim7.3_mac_install.rb
Created May 30, 2012 19:35 — forked from chriskau/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end