Last active
September 20, 2019 14:48
-
-
Save weberhen/e70e35b8446973a89032c6de0fef7f75 to your computer and use it in GitHub Desktop.
python numpy tricks
This file contains 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
list of numpy arrays to a single numpy array | |
numpy_array = np.array(np.concatenate(tuple(list))) | |
force image resize to specific size | |
convert '*.jpg[200x100!]' resized%03d.png | |
serve html files (with css) accessible through SVN: | |
svn propset svn:mime-type text/css doc/build/html/_static/*.css | |
OpenCV convention: | |
frame[height, width] | |
convert image formats (all files inside folder) | |
mogrify -format jpg *.bmp | |
rename all files to sequential number order | |
ls | cat -n | while read n f; do mv "$f" `printf "plank_%06d.jpg" $n`; done | |
OR to rename starting from a given number: i=2501; for file in *.jpg; do mv "$file" $(printf "other_%06d.jpg" "$i"); i=$((i + 1)); done | |
move random number of files to another folder | |
shuf -n 50 -e source/* | xargs -i mv {} dest/ | |
Combine 3 separate numpy arrays to an RGB image in Python | |
rgb = np.dstack((r,g,b)) # stacks 3 h x w arrays -> h x w x 3 | |
Rename all file's extension (from m4b to m4a): | |
rename 's/.m4b$/.m4a/' *.m4b | |
check subfolders size: | |
du -shc <foldername> | |
check overall size of folders on computer: | |
df --total -hl | |
save docker image without keeping history | |
docker export [containerID] -o containername.tar | |
docker import -m "commit message here" containername.tar imagename:tag | |
error when running pip install ('libmagic not found') | |
apt-get install libmagic-dev | |
problems 'ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory' | |
apt-get install libgtk2.0-dev | |
commit git svn only some modified files | |
http://juststuffreally.blogspot.com/2008/10/how-to-git-svn-dcommit-with-local.html | |
install pip stuff on windows | |
first do pip download 'package' to see all dependencies, then download the ones that are being blocked, then do: | |
for %v in (*.whl) do pip install %v | |
This will install all dependencies, then you can go back to the usual pip install 'package' and it should be installed normally |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment