Skip to content

Instantly share code, notes, and snippets.

StayerX /
Created Jun 5, 2016
OCR Images to text
#!/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"
StayerX /
Last active May 25, 2016 — forked from holms/
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
# Add multimedia source
apt-get install software-properties-common
add-apt-repository "deb `lsb_release --codename|cut -f2` main non-free"
grep -q -F 'deb-src' /etc/apt/sources.list|| echo 'deb-src sid main' >>
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
StayerX /
Created Apr 10, 2016 — forked from pkuczynski/
Read YAML file from Bash script
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]}}
You can’t perform that action at this time.