Skip to content

Instantly share code, notes, and snippets.

View andrewgribben's full-sized avatar

Andrew Gribben andrewgribben

View GitHub Profile
@andrewgribben
andrewgribben / gist:3897596
Created October 16, 2012 06:45 — forked from legumbre/gist:1182280
unpaper | postprocessing scanned book example
# convert multipage pdf to single page tiff
gs -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 -sOutputFile=%04d.tif source.pdf -c qui
# or use -sDEVICE=pgmraw to convert to pgm
# unpaper, rotate the logical page 90 degrees, each logical page contained two scanned physical pages, so we use --layout double (for input) and --output-pages 2 since we want to split these two pages.
unpaper -v --deskew-scan-deviation 3.0 --border-align top --deskew-scan-range 15 --no-grayfilter --no-blurfilter --no-noisefilter --overwrite --pre-rotate 90 --border-scan-step 4 --layout double --output-pages 2 %04d.pgm.pbm unpaper%04d.pbm
# trim the pages and convert the to single-page pdfs
find . -name 'unpaper*' | xargs -i -n1 -P6 convert -trim +repage {} {}.pdf
@andrewgribben
andrewgribben / 0_reuse_code.js
Last active September 14, 2015 08:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@andrewgribben
andrewgribben / vhost-wildcard-subdomain.conf
Last active September 20, 2015 19:09 — forked from ofus/vhost-wildcard-subdomain.conf
Apache Virtual Hosts with wildcard subdomain matching
UseCanonicalName Off
<VirtualHost *:80>
ServerAdmin nobody@example.com
ServerAlias *.example.com
VirtualDocumentRoot /var/www/%1/public
DirectoryIndex index.php index.htm index.html
<Directory /var/www/*/public/>
AllowOverride All
</Directory>
@andrewgribben
andrewgribben / osx-setup.sh
Created November 8, 2016 11:18 — forked from somebox/osx-setup.sh
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
@andrewgribben
andrewgribben / epub_footnotes
Created March 22, 2017 14:41
Epub footnote example
<?xml version='1.0' encoding='utf-8' ?>
<html xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ibooks="http://www.apple.com/2011/iBooks"
xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:epub="http://www.idpf.org/2007/ops"
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta charset="utf-8" />
<title>Test Content</title>
</head>
<body>
@andrewgribben
andrewgribben / ituneshijack.scpt
Last active March 23, 2017 16:27
Record tagged tracks from iTunes using Audio Hijack Pro
property update_delay : 1.0E-3
property output_folder : "/Users/<<ENTERUSERNAME>>/Music/"
set folder_path to output_folder
property nameOfTrack : ""
property nameOfAlbum : ""
property nameOfArtist : ""
property file_extension : ".mp3"
property check_delay : 0.1 (* How often to check for a new track *)
property write_delay : 2 (* How long to wait before updating file name *)
@andrewgribben
andrewgribben / weechat.md
Created February 21, 2018 23:39 — forked from zer4tul/weechat.md
A Simple, Base16 Friendly, Weechat Setup

A Simple, Base16 Friendly, Weechat Setup

Scripts

  • Some must-have scripts
  /script install buffers.pl buffer_autoclose.py iset.pl go.py colorize_nicks.py