Skip to content

Instantly share code, notes, and snippets.

View tldrafael's full-sized avatar

Rafael Toledo tldrafael

View GitHub Profile
export UID=$(id -u)
export GID=$(id -g)
docker run --user $UID:$GID \
--workdir="/home/$USER" \
-v "/etc/group:/etc/group:ro" \
-v "/etc/passwd:/etc/passwd:ro" \
-v "/etc/shadow:/etc/shadow:ro" \
-it $DOCKER_IMAGE
@tldrafael
tldrafael / findresolution.txt
Last active March 23, 2022 18:24
Get all images' resolutions contained on a directory
for f in *; do file $f | sed 's/.*, \(.*\)x\(.*\),.*/\1x\2/'; done | sort | uniq -c
@tldrafael
tldrafael / convert_masksize.txt
Created March 23, 2022 18:29
Generic example to convert image mask size and keep only 0, 1 values
convert $f -interpolate nearest-neighbor -interpolative-resize 352x288! $newf
$ for f in `ls *`; do nc=${#f}; nc2=$((10-$nc)); if [ $nc2 -gt 0 ]; then preffix=`printf '0%.0s' $(seq 1 $nc2)`; newf=$preffix$f; mv $f $newf; fi; done
@tldrafael
tldrafael / gist:5786628185d44f289257954bb2c32297
Created January 8, 2025 21:40
Tensorboard-logdir script
echo -e "\n\n"
TB_ARG=''
i=1
for letter in {a..z}; do
if [ $i -lt $(($#+1)) ]; then
line="${letter}:${!i}"
echo -e $line
TB_ARG+="${line}/logs,"