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
metadata {
definition (name: "Securifi Key Fob", namespace: "tierneykev", author: "Kevin Tierney") {
capability "Configuration"
capability "Button"
//desc: 08 0104 0401 00 03 0000 0003 0500 02 0003 0501
//inCluster - 0x0500 - IAS Zone, outCluster- 0x0501 - IAS ACE
fingerprint profileId: "0104", deviceId: "0401", inClusters: "0000,0003,0500", outClusters: "0003,0501"
}
@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 / organize_photopass_photos.py
Created November 14, 2017 13:15
Organize WDW Photopass Photos
import shutil,os
#Place the .py file in the source directory
source_dir = os.getcwd()
for file in os.listdir(source_dir):
file_name, file_ext = os.path.splitext(file)
if os.path.isfile(file) and file_ext != '.py':
print file
file_name_split = file_name.split("_")
@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