This section is inspired by Markdown Guide - Basic Syntax.
- Philosophy
- Easy-to-read and Easy-to-write
- Headings
- Paragraphs
- Indentation
- Line Breaks
- Two
\n
or Two white spaces - For line break, use trailing white space or the HTML tag at the end of the line
- Two
- Emphasis
- Bold
- Italic
- Bold and Italic
- Blockquotes
- Single block
- Multiline
- Nested Blockquotes
- Blockquotes with Other Elements
- Lists
- Ordered List
- Unordered List
- Adding Elements in Lists
- Four Spaces or One Tab
- Nested List
- Four Spaces or One Tab
- Code
- Single Line code
- Code Blocks
- Escaping Backticks
- Horizontal Rules
- Links
- Adding Titles
- Formatting Links
- Reference-style Links
- Images
- Adding Titles
- Math Mode
- Escaping Characters
This article is inspired by Missing Semester - Version Control (Git) and Version control concepts and best practices.
- Pre-Git history
- Brief Introduction to Git
- Repositories and working copies
- Model of Git
- Snapshot
- Linear History (Directed Acyclic Graph)
- Data model
- Hash Function: sha1
- References: Master and HEAD
- Staging Area
- Git commands
- Basics
- Branching and merging
- Remotes
- Undo
- Advanced Commands
git add -p
blame
rebase
stash
.gitignore
- Best practice to use Git
- Don't commit generated files
- Write a good commit messages (cz)
- More to explore: submodules, gpg, pre-commit hook...
This section is inspired by Shell Scripting for Beginners – How to Write Bash Scripts in Linux.
- Shebang revisited
- Declare variables in Shell
- Arithmetic Expressions
- How to read user input
- Numeric Comparison logical operators
- If and AND + OR
- Loop
- Looping with Numbers
- Looping with Strings
- While Loop
- Function and Arguments
-
Write bash functions marco and polo that do the following. Whenever you execute marco the current working directory should be saved in some manner, then when you execute polo, no matter what directory you are in, polo should cd you back to the directory where you executed marco. For ease of debugging you can write the code in a file
marco.sh
and (re)load the definitions to your shell by executingsource marco.sh
. -
Write a
tiny-echo
bash function that prints all the arguments it received to the terminal. You should not useecho
in your function. (printf
may be a helpful function.) -
Say you have a command that fails rarely. In order to debug it you need to capture its output, but it can be time-consuming to get a failure run. Write a bash script that runs the following script until it fails and captures its standard output and error streams to files and prints everything at the end. Bonus points if you can also report how many runs it took for the script to fail.
#!/usr/bin/env bash
n=$(( RANDOM % 100 ))
if [[ n -eq 42 ]]; then
echo "Something went wrong"
>&2 echo "The error was using magic numbers"
exit 1
fi
echo "Everything went according to plan"