{"id":39507483,"url":"https://github.com/valosekj/bash_basics","last_synced_at":"2026-01-18T05:58:48.274Z","repository":{"id":45069245,"uuid":"229782500","full_name":"valosekj/bash_basics","owner":"valosekj","description":"Bundle of bash, python and matlab scripts and functions used in routine work","archived":false,"fork":false,"pushed_at":"2025-12-12T10:08:07.000Z","size":107,"stargazers_count":3,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T22:38:58.702Z","etag":null,"topics":["bash","matlab","python","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valosekj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-23T15:57:15.000Z","updated_at":"2025-12-12T10:08:07.000Z","dependencies_parsed_at":"2025-12-12T15:06:10.102Z","dependency_job_id":null,"html_url":"https://github.com/valosekj/bash_basics","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/valosekj/bash_basics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valosekj%2Fbash_basics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valosekj%2Fbash_basics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valosekj%2Fbash_basics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valosekj%2Fbash_basics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valosekj","download_url":"https://codeload.github.com/valosekj/bash_basics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valosekj%2Fbash_basics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28531940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","matlab","python","shell"],"created_at":"2026-01-18T05:58:48.216Z","updated_at":"2026-01-18T05:58:48.266Z","avatar_url":"https://github.com/valosekj.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Information\n\nBundle of bash, python and matlab scripts and functions used in routine work.\n\n\n## General functions:\n\nUsed within another scripts for checking input, running commands, logging etc.\n \n `check_input` - script for checking existency of directories or files\n \n `exe` - script for execution certain command and prints its output to log\n \n `show` - script for printing messeage or command's output in various ways (e.g. like ERROR in red color)\n \n## Functions for monitoring of running processes:\n \nUsed for monitoring of running processes.\n \n `get_elapsed_time` - get elapsed time based on processID (pid)\n \n `exe_kill` - execute certain command, monitor it and kill if it runs over time limit\n \n `wait_then_kill` - monitor process based on its pid and kill it if the process run longer than set time limit (can be called from `exe_kill`)\n \n `kill_process` - kill process based on processID (pid)\n \n `get_pid_and_name` - get pid and full process name based on process name\n \n `get_pid` - get pid based on process name\n \n## Functions for working with DWI data:\n\nUsed for manipulation with diffusion-weighted MRI data (dMRI/DWI)\n\n `prepare_topup_file` - create a text file for FSL's topup function\n \n `prepare_eddy_file` - create a text file for FSL's eddy function\n \n `get_unique_bvals` - get unique b-values from input bval file\n \n `count_bvals.py` - python script for counting number of DWI volumes acquired with given b-value\n \n `separate_b0_and_dwi` - separate b0 and DWI volumes from 4D diffusion image\n \n `create_dummy_b0_bval_and_bvec` - create dummy bval and bvec files with zeros\n  \n `merge_bval_bvec_files` - merge bval/bvec files into one\n  \n `parse_SliceTiming_from_json.m` - matlab function for fetching of SliceTiming parameter from .json (used for --slspec flag of FSL's eddy)\n \n `display_bvecs.m` - matlab function for simple 3D visualisation of gradient vectors based on bvec file\n \n## Functions for working with MRI data headers:\n\n `parse_dicom_header.sh` - parse dicom header and fetch specific tags (this script requires [AFNI dicom_hdr](https://afni.nimh.nih.gov/pub/dist/doc/program_help/dicom_hdr.html) function)\n \n `compare_nifti_headers.sh` - compare headers of two input nifti files\n    \n\n## Some other functions/scripts:\n\n `get_ip_adress` - print hostname and IP adress to CLI\n \n `run_matlab` - script for running matlab from command line without opening MATLAB desktop\n  \n `send_email_when_finish` - send email when process finish\n \n and some others, see `other_tools` folder\n\n# Usage:\n\n## Clone (download) repo:\n\n```\ncd ${HOME}/code\ngit clone https://github.com/valosekj/bash_basics.git\n```\n\nNote: I recommend to clone the repo into `${HOME}/code` directory\n\n## Usage inside scripts\n\nInclude following lines into your script:\n\n```\nsource ${HOME}/code/bash_basics/config_bash.sh\n\nexport LOGPATH=./log.txt\nexec \u003e \u003e(tee -a $LOGPATH) 2\u003e\u00261\n```\n\n## Usage in terminal/CLI\n\nYou can `source` this repo within your `bashrc`/`zshrc` file to be able to use functions in CLI:\n\n```\n# Add following lines to your ${HOME}/.bashrc or ${HOME}/.zshrc file\nsource ${HOME}/code/bash_basics/config_bash.sh\n```\n\n# Contact: \n\n[Jan Valosek](https://janvalosek.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalosekj%2Fbash_basics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalosekj%2Fbash_basics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalosekj%2Fbash_basics/lists"}