- Last modified: 2026-09-30
- Sign: Johan Nylander
Examples of doing the same thing on many input files, often called "loops" (since after finishing the first file, we return to the beginning of our commands and do it all over again).
| Recently, I tried to upgrade [nf-core](https://nf-co.re/) on my Ubuntu Linux but the execution after installation failed with errors from a python module. | |
| Upgrading the python library ["rich"](https://rich.readthedocs.io/en/stable/introduction.html) solved the issue. | |
| Steps below: | |
| ``` | |
| $ cat /etc/lsb-release | |
| DISTRIB_ID=Ubuntu | |
| DISTRIB_RELEASE=20.04 | |
| DISTRIB_CODENAME=focal |
| #!/usr/bin/env bash | |
| # Start/stop FortiClient VPN | |
| # Last modified: ons mar 15, 2023 03:47 | |
| # Sign: JN | |
| # To disable starting forticlient after reboot: | |
| # 1. Comment out the command (edit and add an `#` in front of the line) in file | |
| # `/opt/forticlient/start-fortitray-launcher.sh` | |
| # 2. `sudo systemctl disable forticlient-scheduler` | |
| # After step 1 and 2 above, forticlient daemon will not start after reboot. To |
| #!/usr/bin/env perl | |
| =pod | |
| =encoding utf8 | |
| =head1 NAME | |
| create_sample_sheet.pl - Create sample sheet from NGI delivery |
| #! /bin/bash | |
| # blast2fasta | |
| # Parse output from blast where we have sseq as the last column. | |
| # For example (argument to blastn): "-outfmt '6 qseqid sseq'". | |
| # Reads from file, writes to stdout. | |
| # By Johan Nylander | |
| # 2023-Oct-10 | |
| # Usage: blast2fasta.sh file | |
| file=$1 | |
| awk '{printf ">%s", $1; for(i=2;i<NF;i++) printf " %s", $i; printf "\n%s\n", $NF}' "$file" |
| #!/usr/bin/env Rscript | |
| # File: summary | |
| # Description: Summarize data from stdin as min, max, mean, median | |
| # Requirements: R | |
| # Usage example: for i in $(seq 1 100); do echo $RANDOM; done | summary | |
| # 288 32697 14644.19 14256 | |
| a <- scan(file("stdin"), c(0), quiet=TRUE); | |
| cat(min(a), max(a), mean(a), median(a), "\n"); |
FILE: fas2nex.stdinout
USAGE: ./fas2nex.stdinout <input>
| #!/bin/bash | |
| # Convert Markdown to PDF using pandoc | |
| # Last modified: tor aug 20, 2020 02:51 | |
| # Johan Nylander | |
| # TODO: set mainfont to allow for special characters () -V 'mainfont:xxx xx' | |
| hash pandoc 2>/dev/null || { echo >&2 "Cannot find pandoc. Aborting."; exit 1; } | |
| for f in "$@" |
| #!/bin/bash | |
| # Convert Markdown to PDF (beamer) using pandoc | |
| # Last modified: mån sep 07, 2020 03:05 | |
| # Johan Nylander | |
| for f in "$@" | |
| do | |
| echo -n "Converting $f ..." | |
| g=${f%.md}.pdf |