Skip to content

Instantly share code, notes, and snippets.

View predictiple's full-sized avatar

predictiple

  • South Africa
View GitHub Profile
#!/bin/bash
interval=$(printf "%s" "$1"|tr -dc '[:digit:]')
half_interval=$(expr $interval \/ 2)
interval=$(expr $half_interval \* 2)
interval_text=$(date -u -d "@${interval}" "+%T")
date_text=$(pwd |rev |cut -d"/" -f1 |rev |cut -d" " -f1)
full_date_text=$(pwd |rev |cut -d"/" -f1 |rev)
mkdir ${date_text}_events
!#/bin/bash
find . -type f -iname "*.avi" -print | while read line; do
duration=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f1 |cut -d' ' -f4)
framerate=$(ffprobe -i $line 2>&1 > /dev/null |grep Stream |cut -d',' -f4 |cut -d' ' -f2)
bitrate=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f3 |cut -d' ' -f3-)
modified=$(stat $line |grep Modify |cut -d' ' -f3 |cut -d'.' -f1)
file=$(echo $line | cut -d'/' -f2)
echo $file,$framerate,$bitrate,$duration,$modified >> times_temp1.csv
done
#!/bin/bash
find ./motion/ -type f -iname "*.jpg" -print | while read file
do
image=$file
convert -extract 190x56+700+620 -fuzz 20% -fill black +opaque yellow $image extract_replace.png
convert -colors 2 -threshold 50% -negate extract_replace.png extract_mono.png
timestamp=$(tesseract -psm 7 -l ecr extract_mono.png stdout |tr ":" "-")
cp $image ./motion/$timestamp.jpg
echo $image copied to $timestamp.jpg

####Commands to train Tesseract for Envy Code R font

####Usage

Before running the commands, use jTessBoxEditor to generate the tiff/box file pair and place it in the script folder. Training text can be generated with the following command line and then used in jTessBoxEditor:

for i in {1..200}; do for j in ":" 0 1 2 3 4 5 6 7 8 9; do echo -n $j >>training_text.txt; done; done

####Notes

1
00:00:00,000 --> 00:00:00,999
Mon 2015-08-24 00:00:00
2
00:00:01,000 --> 00:00:01,999
Mon 2015-08-24 00:00:01
3
00:00:02,000 --> 00:00:02,999
# ./motion.conf
#
# This config file was generated by motion 3.2.12
############################################################
# Daemon
############################################################
# Start in daemon (background) mode and release terminal (default: off)
!#/bin/bash
find . -type f -iname "*.avi" -print | while read line; do
duration=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f1 |cut -d' ' -f4)
framerate=$(ffprobe -i $line 2>&1 > /dev/null |grep Stream |cut -d',' -f4 |cut -d' ' -f2)
bitrate=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f3 |cut -d' ' -f3-)
modified=$(stat $line |grep Modify |cut -d' ' -f3 |cut -d'.' -f1)
file=$(echo $line | cut -d'/' -f2)
echo $file,$framerate,$bitrate,$duration,$modified >> times_temp1.csv
done
@predictiple
predictiple / custom.css
Created February 6, 2016 21:40
Jupyter custom css
@import url(https://fonts.googleapis.com/css?family=Roboto+Condensed:400,300,700&subset=latin,latin-ext);
@import url(https://fonts.googleapis.com/css?family=Roboto+Slab&subset=latin,latin-ext);
table.dataframe {
border-collapse: collapse;
border: none;
}
table.dataframe tr {
border: none;
}
name: py2
dependencies:
- anaconda-client=1.2.2=py27_0
- apptools=4.2.1=py27_0
- backports_abc=0.4=py27_0
- bcolz=0.11.3=py27_0
- blaze=0.9.0=py27_0
- blaze-core=0.9.0=py27_0
- bokeh=0.11.1=py27_0
- cairo=1.12.18=6
name: py3
dependencies:
- anaconda-client=1.2.2=py34_0
- backports_abc=0.4=py34_0
- bcolz=0.12.1=np110py34_0
- blaze=0.9.0=py34_0
- blaze-core=0.9.0=py34_0
- bokeh=0.11.1=py34_0
- cairo=1.12.18=6
- certifi=2015.9.6.2=py34_0