Skip to content

Instantly share code, notes, and snippets.

@tierneykev
tierneykev / compress-pdf-with-gs.md
Created November 9, 2018 18:58 — forked from vibegui/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.
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@tierneykev
tierneykev / disneyDiningCheck.py
Last active January 10, 2018 18:27 — forked from mrichardson23/disneyDiningCheck.py
Disney dining check
# This script checks for availability of Disney Dining reservations.
# It will use Pushbullet to send notifications to any device. Set up an account there and get your API key.
'''
Revision History:
1/8/2013
Use BeautifulSoup to extract pep_csrf_value and id_value
Set log to same directory as py script
Added check to see if pb_api_key set - if not then do not use PB Api
1/9/2013 - Swapped out pushbullett integration to IFTTT
@tierneykev
tierneykev / tbdba-restore-mysqldump.pl
Created August 1, 2017 20:10 — forked from sennajox/tbdba-restore-mysqldump.pl
A copy of tbdba-restore-mysqldump.pl
#!/usr/bin/perl
# First written by orczhou.com orchzou@gmail.com
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
# How faster it is:
# $ls -lh backup.sql.gz
# -rw-r--r-- 1 mysql dba 14G Nov 21 04:49 backup.sql.gz