Skip to content

Instantly share code, notes, and snippets.

@StayerX
StayerX / ocr-image.sh
Created Jun 5, 2016
OCR Images to text
View ocr-image.sh
#!/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
StayerX / full-ffmpeg.sh
Last active May 25, 2016 — forked from holms/full-ffmpeg.sh
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
View full-ffmpeg.sh
# 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
@StayerX
StayerX / parse_yaml.sh
Created Apr 10, 2016 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
View parse_yaml.sh
#!/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]}}
You can’t perform that action at this time.