Skip to content

Instantly share code, notes, and snippets.

View andrewgribben's full-sized avatar

Andrew Gribben andrewgribben

View GitHub Profile
@legumbre
legumbre / gist:1182280
Created August 30, 2011 22:29
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
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 29, 2024 16:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@macdonst
macdonst / ft.js
Created October 4, 2012 17:14
FileTrasfer a bunch of files.
var remoteFiles = [];
function downloadRemotePDF() {
var local2User = JSON.parse( localStorage["locallessons"] );
$.each(local2User, function(key) {
remoteFiles.push(optionsJSON + local2User[key].idcountries + '/' + local2User[key].idcurriculum + '/' + local2User[key].idoptions + '/pdf/' + local2User[key].pdfname);
}
downloadFile();
}
@patocallaghan
patocallaghan / useful-vim-commands
Last active September 19, 2023 10:10
A collection of useful VIM commands I always have trouble remembering..
#Check system version information
:version
#Check what plugins are installed
:scriptnames
#Open .vimrc
<leader> + e,v
#Reload .vimrc
@NickBarreto
NickBarreto / iBooks popups which degrade nicely in other devices
Last active February 2, 2019 16:33
How to create popup footnotes in iBooks which degrade well for other EPUB3 readers
The only requirements for popup footnotes in iBooks are:
* Ebook has to be an EPUB3
* epub:type "noteref" and "footnote"
So you can link to a totally separate document, as you normally would for endnotes,
but include the attributes so the <a> link behaves differently in iBooks, instead triggering the popup.
Original reference link would look something like this (in a file called ch001.html):
<a epub:type="noteref" href="footnote.html#note1">1</a></div>
@adaptivegarage
adaptivegarage / theme-detect.css
Last active January 17, 2023 06:04
Pure CSS ePub theme detection (White / Sepia / Night) in iBooks (Mac OS and iOS included)
/*
Pure CSS ePub theme detection (White / Sepia / Night) in iBooks (Mac OS and iOS included)
Version 1.1
Note that iBooks actually uses internal JavaScript to set the "__ibooks_internal_theme" attribute on :root (html) element
every time the theme is changed, but this happens independently of whether your epub html markup is scripted or not.
Discovered and tested in iBooks on Mac, iPhone and iPad by
https://twitter.com/adaptivegarage
*/
@JayPanoz
JayPanoz / user_stylesheet_base.css.tmpl
Created November 25, 2015 17:44
iBooks's default CSS
@namespace epub "http://www.idpf.org/2007/ops";
@namespace svg "http://www.w3.org/2000/svg";
/* Hide soundtrack <audio> tags from ever showing up */
audio[epub|type~="ibooks:soundtrack"] {
display: none !important;
/* display: none; doesn't seem to actually work for some reason, so hide it another way */
height: 0 !important;
}
@fats
fats / weechat_theme.txt
Last active October 27, 2023 18:22
[weechat] The Theme™
# requires: 256 color terminal
/script install iset.pl
/script install buffers.pl
/script install colorize_nicks.py
/set weechat.look.buffer_notify_default message
/set weechat.look.color_nick_offline on
/set weechat.look.prefix_action " •"
/set weechat.look.prefix_join "▬▶"
@shuxiao9058
shuxiao9058 / README.md
Created September 19, 2016 13:47 — forked from doitian/README.md
Scripts to control Vitamin-R

Usage

osascript Start.applescript "objective" "tag1,tag2"
osascript Stop.applescript

I have skipped most Vitamin-R workflows. See the attached settings snapshot. If you have them enabled, you need to update the script to handle different steps.

I use the scripts in my org pomodoro script

@stokkes
stokkes / README.md
Last active March 21, 2024 01:37
Rclone Plex Sonarr Radarr Read&Write

Rclone v1.40 for Plex/Sonarr/Radarr Read/Write

This small guide should help you get setup with rclone v1.40 to read/write directly to a cache mount and have Plex get notified of new tv/movies that get added to the mount by Radarr/Sonarr

Assumptions

  1. You're using rclone v1.40
  2. You're using Radarr & Sonarr
  3. If you're using docker for plex/sonarr/radrr, you must ensure the volumes attached to the containers are all the same path, i.e.: /mnt/user/media:/media for all 3. If not, the auto-scan will likely not work properly.