This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Description: OCR images to text | |
# Requires: tesseract-ocr imagemagick xsel | |
# Usage: ocr-image <image(s)> | |
__ocr_image() { | |
local image | |
for image in "$@"; do | |
local tmp_img=$(mktemp) | |
cp "$image" "$tmp_img.png" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add multimedia source | |
apt-get install software-properties-common | |
add-apt-repository "deb http://www.deb-multimedia.org `lsb_release --codename|cut -f2` main non-free" | |
grep -q -F 'deb-src http://www.deb-multimedia.org' /etc/apt/sources.list|| echo 'deb-src http://www.deb-multimedia.org sid main' >> foo.bar | |
apt-get update | |
apt-get install deb-multimedia-keyring # if this aborts, try again |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
parse_yaml() { | |
local prefix=$2 | |
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') | |
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ | |
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | | |
awk -F$fs '{ | |
indent = length($1)/2; | |
vname[indent] = $2; | |
for (i in vname) {if (i > indent) {delete vname[i]}} |