Sometimes, I need to call/run python script with arguments from shell. I use bash or zsh as my shell and following workaround works great for me.
- Some example python script which I need to run from bash:
my_python_script.py
:
I need very often to modify filenames or replace/delete their parts across huge number of files. I was using sed command for these purposes but recently I have found out that all these tasks can be easily done directly in bash (or zsh) because both of them support so called string manipulation operations.
Define some example string:
$ file=some_file_name.txt
I use on my iPhone HEIF (High Efficiency Image File Format) format for storing my photos.
This format is widely supported throughout Apple ecosystem but sometimes I need to quickly convert photos from HEIF to JPG to be able to use these photos also elsewhere (Windows, some websites, etc.)
I use for this purpose convert
command line tool from ImageMagick
The content of this gist was moved to this repo: https://github.com/valosekj/zsh_config
Sometimes, it is convenient to have possibility to start/run any application (like your internet browser or text editor) directly from your terminal. Most of these applications however do not create shortcut for easy run from terminal during their installation. Below is short manual how to create this shortcut manually.
Open terminal (cmd + space --> type terminal
)
Navigate to a directory where you have your code/scripts. For example ~/code
or /usr/local/bin
:
I needed to run matlab script from python script. I wanted to pass several input arguments from pandas DataFrame, perform calculation in matlab and return multiple output arguments back to python.
In your terminal, go to directory where matlab is install and run installation python script, e.g.: