Skip to content

Instantly share code, notes, and snippets.

@eheikes
eheikes / tts.sh
Created February 10, 2016 03:52
Converts images & PDF files to text.
#!/bin/bash
#
# Converts images & PDF files to text.
# See http://ericheikes.com/converting-books-to-mp3-audio-text-to-speech
#
# Concatenate all the files.
cat "$@" > out.txt
# Combine words that are broken (with hyphens) across lines.
@eheikes
eheikes / textify.sh
Last active December 16, 2016 04:17
Converts images & PDF files to text.
#!/bin/bash
#
# Converts images & PDF files to text.
# See http://ericheikes.com/converting-books-to-mp3-audio-text-to-speech
#
for file in "$@"
do
extension="${file##*.}"
basename=`basename "$file" .$extension`
@eheikes
eheikes / pitchfork-preview.js
Last active May 27, 2018 16:50
Opens a Pitchfork album review in Amazon for music previewing
(function(){
var artist = document.querySelector('.artist-links').textContent;
var album = document.querySelector('.single-album-tombstone__review-title').textContent;
var searchString = artist + ' ' + album;
var encoded = encodeURIComponent(searchString.replace(/\bep\b/gi, '')).replace(/ /g, '+');
var url = 'http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Ddigital-music&field-keywords=' + encoded;
window.open(url, 'mp3search');
})();
@eheikes
eheikes / install-npm-modules.sh
Last active June 15, 2020 21:49
Globally-installed npm modules
#!/bin/sh
# npm config set progress false -g
npm install -g \
@captainsafia/legit \
binci \
commitizen \
cz-conventional-changelog \
depcheck \
dockly \
fkill-cli \
@eheikes
eheikes / git-custom.sh
Last active April 15, 2022 00:22
Git customizations for oh-my-zsh
# Remove the -v option.
alias gc='git commit'
alias gca='git commit -a'
# Create a 'gd' alias.
alias gd="clear; git diff"
compdef _git gd=git-diff
# Create other pull/push aliases.
alias gpull='git fetch origin && git rebase -r origin/`git symbolic-ref --short HEAD 2>/dev/null` "$@" || echo "💣\n💣\n💣\n💣\tCOULD NOT REBASE!\n💣\n💣\n💣"; true'
@eheikes
eheikes / .zshrc
Last active February 24, 2017 17:43
Shell profile
plugins=(extract git git-eheikes git-extras frontend-search node npm screen)
umask 002
alias tracert=traceroute
alias wdiff="dwdiff -c"
alias ssh=autossh
alias translate=termit
alias stash="git stash"
alias hubb="hub browse"
alias weather="curl http://wttr.in/Des%20Moines"
@eheikes
eheikes / .emacs
Last active February 21, 2017 17:09
Personal emacs config
(setq default-tab-width 4)
(setq column-number-mode t)
(recentf-mode 1) ; File->Recent files
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) ; turn off toolbar
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome")
(setq backup-inhibited t)
(setq auto-save-default nil)
;; Org mode settings
@eheikes
eheikes / gist:2df5d8d1cde82933934d
Created July 16, 2014 16:14
npm install touch error
This file has been truncated, but you can view the full file.
20010 verbose fetch to= /jenkins/tmp/npm-1828-OZKAuTho/1404456112127-0.6931601180694997/tmp.tgz
20011 http GET https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
20012 http GET https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.25-1.tgz
20013 silly lockFile 19ea773f-s-minimatch-node-modules-sigmund tar:///jenkins/workspace/banno-sentry/node_modules/grunt-contrib-htmlmin/node_modules/html-minifier/node_modules/cli/node_modules/glob/node_modules/minimatch/node_modules/sigmund
20014 silly lockFile 19ea773f-s-minimatch-node-modules-sigmund tar:///jenkins/workspace/banno-sentry/node_modules/grunt-contrib-htmlmin/node_modules/html-minifier/node_modules/cli/node_modules/glob/node_modules/minimatch/node_modules/sigmund
20015 silly lockFile 0c6c0193-ns-npm-sigmund-1-0-0-package-tgz tar:///jenkins/.npm/sigmund/1.0.0/package.tgz
20016 silly lockFile 0c6c0193-ns-npm-sigmund-1-0-0-package-tgz tar:///jenkins/.npm/sigmund/1.0.0/package.tgz
20017 info preinstall sigmund@1.0.0
20018 verbose readDependencies u
@eheikes
eheikes / netflix-instant.js
Last active May 12, 2018 16:58
Randomly choose an item from your Netflix Instant queue. Run it on the My List page (after loading the whole page).
(function(){
var hd = document.querySelector('.main-header');
var movies = [].slice.call(document.querySelectorAll('.slider-item'));
var len = movies.length;
var i = Math.floor(Math.random() * len) + 1;
var movie = movies[i-1];
movies.forEach(function(movie) { movie.style.border = 'none'; });
movie.style.border = '2px solid red';
console.log(movie.querySelector('[aria-label]').getAttribute('aria-label'));
window.scrollBy(0, movie.getBoundingClientRect().top - hd.offsetHeight - 10);
@eheikes
eheikes / Gruntfile.js
Last active August 29, 2015 14:01
How to access a task's filesSrc (expanded files) from another config
module.exports = function(grunt) {
// The helper function to access the filesSrc of the specified task
function filesSrc(configName) {
var config = grunt.config(configName);
var tasks = grunt.task.normalizeMultiTaskFiles(config);
return grunt.util._(tasks).chain().pluck('src').flatten().uniq().value();
}
// Example config