Code Examples
Different Ways to Style & Author Code
Inline Code
⚠️ Not documented yet.
Code Block
Syntax
Correct
```syntax
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBN+Mh3U/3We4VYtV1QmWUFIzFLTUeegl1Ao5/QGtCRGAZn8bxX9KlCrrWISIjSYAwCajIEGSPEZwPNMBoK8XD8Q= ylo@klar
```
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBN+Mh3U/3We4VYtV1QmWUFIzFLTUeegl1Ao5/QGtCRGAZn8bxX9KlCrrWISIjSYAwCajIEGSPEZwPNMBoK8XD8Q= ylo@klar
Command Line
Preferred
```cmd-line
module load kitten
```
module load kitten
Pros & Cons
- Pro: Easy to write, maintain, and teach.
- Pro: Follows the WHATWG standard example.
- Pro: Can have syntax highlighting.
- Con: Can not add internal markup (e.g.
<code>something <strong>bold</strong></code>
).
Avoided
<pre class="cmd-line"><code>module <strong>load <em>kitten</em></strong></code></pre>
module load kitten
Pros & Cons
- Pro: Follows the WHATWG standard example.
- Hmm: Can
- either use internal markup (e.g.
<code>something <strong>bold</strong></code>
) (current setup) - or syntax highlighting (if developer changes configuration).
- either use internal markup (e.g.
- Con: Not easy to write, maintain, and teach.
Deprecated
<pre class="cmd-line">module <strong>load <em>kitten</em></strong></pre>
module load kitten
Pros & Cons
- Pro: Can add internal markup (e.g.
<code>something <strong>bold</strong></code>
). - Con: Does not follow the WHATWG standard example.
- Con: Can not have syntax highlighting (without caveats and overhead).
Job Script
Preferred
```job-script
#!/bin/bash
#SBATCH -J myjob # job name
#SBATCH -e myjob.%j.err # error file name
#SBATCH -o myjob.%j.out # output file name
#SBATCH -N 2 # request 2 nodes
#SBATCH -n 96 # request 2x48=96 MPI tasks
#SBATCH -p skx-normal # designate queue
#SBATCH -t 24:00:00 # designate max run time
#SBATCH -A myproject # charge job to myproject
module load gromacs/2022.1
ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log
```
#!/bin/bash
#SBATCH -J myjob # job name
#SBATCH -e myjob.%j.err # error file name
#SBATCH -o myjob.%j.out # output file name
#SBATCH -N 2 # request 2 nodes
#SBATCH -n 96 # request 2x48=96 MPI tasks
#SBATCH -p skx-normal # designate queue
#SBATCH -t 24:00:00 # designate max run time
#SBATCH -A myproject # charge job to myproject
module load gromacs/2022.1
ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log
Pros & Cons
- Pro: Easy to write, maintain, and teach.
- Pro: Follows the WHATWG standard example.
- Pro: Can have syntax highlighting.
- Con: Can not add internal markup (e.g.
<code>something <strong>bold</strong></code>
).
Avoided
<pre class="job-script">
<code>#!/bin/bash
#SBATCH -J myjob # job name
#SBATCH -e myjob.%j.err # error file name
#SBATCH -o myjob.%j.out # output file name
#SBATCH -N 2 # request 2 nodes
#SBATCH -n 96 # request 2x48=96 MPI tasks
#SBATCH -p skx-normal # designate queue
#SBATCH -t 24:00:00 # designate max run time
#SBATCH -A myproject # charge job to myproject
module <strong>load <em>gromacs/2022.1</em></strong>
ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log</code></pre>
#!/bin/bash
#SBATCH -J myjob # job name
#SBATCH -e myjob.%j.err # error file name
#SBATCH -o myjob.%j.out # output file name
#SBATCH -N 2 # request 2 nodes
#SBATCH -n 96 # request 2x48=96 MPI tasks
#SBATCH -p skx-normal # designate queue
#SBATCH -t 24:00:00 # designate max run time
#SBATCH -A myproject # charge job to myproject
module load gromacs/2022.1
ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log
Pros & Cons
- Pro: Follows the WHATWG standard example.
- Hmm: Can
- either use internal markup (e.g.
<code>something <strong>bold</strong></code>
) (current setup) - or syntax highlighting (if developer changes configuration).
- either use internal markup (e.g.
- Con: Not easy to write, maintain, and teach.
Deprecated
<pre class="job-script">#!/bin/bash
#SBATCH -J myjob # job name
#SBATCH -e myjob.%j.err # error file name
#SBATCH -o myjob.%j.out # output file name
#SBATCH -N 2 # request 2 nodes
#SBATCH -n 96 # request 2x48=96 MPI tasks
#SBATCH -p skx-normal # designate queue
#SBATCH -t 24:00:00 # designate max run time
#SBATCH -A myproject # charge job to myproject
module <strong>load <em>gromacs/2022.1</em></strong>
ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log</pre>
#!/bin/bash #SBATCH -J myjob # job name #SBATCH -e myjob.%j.err # error file name #SBATCH -o myjob.%j.out # output file name #SBATCH -N 2 # request 2 nodes #SBATCH -n 96 # request 2x48=96 MPI tasks #SBATCH -p skx-normal # designate queue #SBATCH -t 24:00:00 # designate max run time #SBATCH -A myproject # charge job to myproject module load gromacs/2022.1 ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log
Pros & Cons
- Pro: Can add internal markup (e.g.
<code>something <strong>bold</strong></code>
). - Con: Does not follow the WHATWG standard example.
- Con: Can not have syntax highlighting (without caveats and overhead).
Syntax Highlighting Reference
- Syntax
- Python-Markdown
fenced_code_blocks
- Python-Markdown
code_hilite
or PyMdown Extensions: Highlight (which extension is used is unclear) - Languages
- Highlight.js: Supported Languages
- Themes
- Highlight.js: Demo
Examples
plaintext
#!/bin/bash
#SBATCH -J myjob # job name
#SBATCH -e myjob.%j.err # error file name
#SBATCH -o myjob.%j.out # output file name
#SBATCH -N 2 # request 2 nodes
#SBATCH -n 96 # request 2x48=96 MPI tasks
#SBATCH -p skx-normal # designate queue
#SBATCH -t 24:00:00 # designate max run time
#SBATCH -A myproject # charge job to myproject
module load gromacs/2022.1
ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log
bash
#!/bin/bash
#SBATCH -J myjob # job name
#SBATCH -e myjob.%j.err # error file name
#SBATCH -o myjob.%j.out # output file name
#SBATCH -N 2 # request 2 nodes
#SBATCH -n 96 # request 2x48=96 MPI tasks
#SBATCH -p skx-normal # designate queue
#SBATCH -t 24:00:00 # designate max run time
#SBATCH -A myproject # charge job to myproject
module load gromacs/2022.1
ibrun gmx_mpi mdrun -s topol.tpr -o traj.trr -c confout.gro -e ener.edr -g md.log
json
{
"email": "user@gmail.com",
"pw": "pass12345"
}
python
import sys
!{sys.executable} -m pip install click
import click