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 | |
CRT=$PWD | |
cd "$1" | |
identify -format "{filename: '%M', aspectRatio: %[fx:(w/h)]},\n" ./*.jpg > "$CRT/data" | |
cd - |
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 | |
# this script should be run by command: find . -type d -exec ./.remove-wrong-images {} \; | |
if [ ! -d "$1" ]; then | |
echo "need a directory" | |
exit 1 | |
fi | |
cd "$1" | |
for f in *.jpg; do | |
[ -f "$f" ] || continue |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
func main() { | |
t := time.Now().Unix() |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"os/user" | |
"path/filepath" | |
) | |
func main() { |
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
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"os" | |
"time" | |
) | |
func main() { |
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
find . -regex '.*\.\(jpg\|png\)$' -exec bash -c 'convert "$@" -define webp:lossless=false -quality 80 "${@%.*}".webp' _ {} \; |
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
function array_vertical($source) { | |
$keys = array_keys($source); | |
$arr = array_values($source); | |
$cut = array_map(null, ...$arr); | |
foreach($cut as &$el) { | |
$el = array_combine($keys, $el); | |
$el = array_filter($el, function($v) {return ! is_null($v);}); | |
} | |
return $cut; | |
$cut=[]; |
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
find <src>/ -type f -regextype posix-extended -regex '^<pattern>$' -print0 | xargs -0i cp --parents "{}" <dest>/ |
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
var dir = new Folder('/c/temp') | |
var files = dir.getFiles("*.psd"); | |
for (var i = 0; i < files.length; i++) { | |
var doc = app.open(files[i]); | |
mutate(doc) | |
doc.close(SaveOptions.SAVECHANGES) | |
} | |
function mutate(el) |
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
cat <path/to/rtf.document> | grep -aEo '{HYPERLINK [^}]+' | cut -d' ' -f 2 | tr -d '"' |