This file contains hidden or 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/bash | |
| path= | |
| i=0 | |
| prevname= | |
| for file in */*/*/*.jpg; do | |
| path="${file%/*}" | |
| name=`basename "$path"` | |
| if [ "$name" == "$prevname" ]; then | |
| i=`expr $i + 1` |
This file contains hidden or 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/bash | |
| # extract images from pdf at first-hand | |
| #prefix=pict | |
| #echo extract images from "$1" | |
| #pdfimages -j "$1" $prefix | |
| # IMAGES ARE SAVED SECVENTIALLY AS IMAGE AND THE NEXT IS A MASK IMAGE !!!! | |
| declare -a files=($(ls *.ppm *.pbm)) | |
| mask= | |
| image= | |
| for (( i = 0; i < ${#files[*]}; i = i + 2 )) |
This file contains hidden or 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/bash | |
| SRC='./src' | |
| DIST='./dist' | |
| CSS='css' | |
| STYLE='style.css' | |
| # minify css files |
This file contains hidden or 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
| for file in $(ls *.jpg -t | head -n 11); do convert $file -resize 50% $file; done |
This file contains hidden or 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
| trait StaticFactory | |
| { | |
| public static function Make() | |
| { | |
| $args = \func_get_args(); | |
| $class = new \ReflectionClass(get_called_class()); | |
| $instance = $class->newInstanceArgs($args); | |
| return $instance; |
This file contains hidden or 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/bash | |
| # $1 = path to directory where docx files are stored | |
| dir="$1" | |
| for dox in $1/*.docx; do | |
| # filename with spaces replaced with underscores | |
| doc="${dox// /_}" | |
| # path without extension | |
| noext=${doc%.*} |
This file contains hidden or 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/bash | |
| files=$1 | |
| for file in $files; do | |
| # first delete all empty, succesive lines | |
| # then add an extra newline | |
| sed -i -r ':a;/^$/{d;ba};x;s/^.+$/\n/g;p;x' "$file" | |
| done |
This file contains hidden or 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/bash | |
| # path where reside images for OCR | |
| path=$1 | |
| filename='' | |
| ocrized='' | |
| home=$(pwd) | |
| # cd $path |
This file contains hidden or 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/bash | |
| # insert text lines after first line and before last line of file | |
| # $1 = a glob expression like */assets/*.css | |
| # $2 = a literal to be inserted after first line | |
| # $3 = same as above but inserted before last line | |
| for f in $1; do | |
| eval "sed -ri '1 s/(.*)/\1\n$2; $ s/(.*)/$3\n\1/' \"$f\"" | |
| done |
This file contains hidden or 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/bash | |
| tempdf=$(tempfile) | |
| gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=$2 -dLastPage=$3 -sOutputFile=$tempdf $1 | |
| gs -dNOPAUSE -sDEVICE=png16m -r600 -dDownScaleFactor=3 -dBATCH -dSAFER -sOutputFile="$4-$2-%00d.png" $tempdf | |
| rm -f $tempdf |