Skip to content

Instantly share code, notes, and snippets.

@aic25
Last active February 26, 2019 02:18
Show Gist options
  • Save aic25/989d6d7908002c18864c80448ed5f30e to your computer and use it in GitHub Desktop.
Save aic25/989d6d7908002c18864c80448ed5f30e to your computer and use it in GitHub Desktop.
shell adventure
~/.bashrc
```
export PATH="/notebooks/webcam/ffmpeg_sources/bin:$PATH"
export OPENCV_FFMPEG_CAPTURE_OPTIONS="video_codec;h264_cuvid"
export OPENCV_V4L_CAPTURE_OPTIONS="video_codec;h264_cuvid"
export OPENCV_V4L2_CAPTURE_OPTIONS="video_codec;h264_cuvid"
alias ls='ls -lsrht --color=auto'
alias docker='sudo docker'
alias nvidia-docker='sudo nvidia-docker'
alias cuda-info='cat /usr/local/cuda/version.txt && nvcc --version'
```
~/.bashrc at ssh
```
sudo sshfs -o allow_other -o uid=1002 -o gid=1002 me@bla.bla:/home/me/Projects/bla ~/bla
sudo sshfs -o allow_other -o uid=1002 -o gid=1002 me@bla.bla:/home/me/DockerFiles ~/DockerFiles
```
~/.bash_logout at ssh
```
sudo fusermount -u DockerFiles/
sudo fusermount -u bla/
```
bash path play
```
$ foo=/usr/local/bin/bar
$ echo "${foo##*/}"
bar
$ echo "${foo%/*}"
/usr/local/bin
filename=$(basename -- "$fullfile")
extension="${filename##*.}"
filename="${filename%.*}"
find . -name \*.xls -exec cp {} newDir \
# watch file tail with filter
watch -n 5 "tail -n 3000 log | grep --line-buffered '.*avg.*' | awk -v n=10 'NR%n==0'"
# draw file tail with filter
[ "$1" ] || (echo "specify input" && exit)
if [ -f $1 ]
then
watch -n 5 "cat $1 | grep --line-buffered '.*avg.*' | awk '\$1%10==0 {print \$3}' | feedgnuplot --lines --points --legend 0 'Yolov3' --title 'Avg loss with mod 10' --terminal 'dumb 90,25' --exit "
fi
tail -n 5000000 log | grep --line-buffered '.*avg.*' | awk '$1%100==0 {print $0}'
command >out 2>&1
strace -p `pidof gdb`
# rmove empty txt file
find . -empty | xargs rm
# copy jpg after txt
find *.txt -exec bash -c 'basename "$0" ".${0##*.}"' {} \; | while read bn; do mv ./data/$bn.jpg ./prepd/; done
# sync server results with local
rsync -uvr ../server/* ../local/
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment