ssh
connection
Configuration of Unix and MacOS
Let's say we want to configure an ssh
connection between machine alpha and beta.
- Go to your home folder at machine alpha:
$ cd ~
import os | |
import glob | |
import hashlib | |
import argparse | |
def compute_checksum(file_path): | |
with open(file_path, 'rb') as f: | |
file_bytes = f.read() | |
return hashlib.md5(file_bytes).hexdigest() |
# Set ITK direction from image1 to image2 | |
# | |
# Usage: | |
# python change_itk_orientation.py <image1> <image2> | |
# Example: | |
# python change_itk_orientation.py sub-001_T1w.nii.gz sub-001_T1w_seg.nii.gz | |
# | |
# Jan Valosek | |
# |
ssh
connectionLet's say we want to configure an ssh
connection between machine alpha and beta.
$ cd ~
This gist describes example of simple workflow on repository whose changes are tracked by git and GitHub
# Go to directory where repository will be cloned (downloaded)
cd ~/Documents
# Clone repository from GitHub
venv
and conda
are environment manager tools allowing to create virtual environments. Virtual environment separates the dependencies (Python packages) for different projects. This mean that each project can have its own dependencies. Usage of virtual environments allows you to avoid installing Python packages globally (to the system Python) which could break system tools or other projects.
MacOS or Linux (without or with site-packages)
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.
my_python_script.py
:
This gist containts several useful tips, tricks and hacks for plotting of figures, plots and charts using python (matplotlib and seaborn packages).
import matplotlib
matplotlib.use('TkAgg')
A few basic shell (bash, zsh, ...) commands for UNIX (Linux, MacOS) CLI (command-line interface)
cd
- change directory:# change directory to /home/username/Downloads:
This gist contains several useful shell commands which I use frequently during my work.
$0
- Get current shell
$ echo $0
zsh
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