Elements of Effective Tooling, Winter Term 2021/2022

  • Instructor: Lorenz Schmidt, Nils Werner
  • Format: Workshop, in English
  • Schedule:
    • Nov 03, Time: 16:15 - 17:45: Unix basics + the shell (Bash)
    • Nov 10, Time: 16:15 - 17:45: Version control (Git)
    • Nov 17, Time: 16:15 - 17:45: Automation (Gitlab Runner)
    • Nov 24, Time: 16:15 - 17:45: Shell Scripting (Bash)
  • Objective: Learn essential tools for your HiWi/thesis/etc. and common patterns in the computing ecosystem
  • Location: Via ZOOM. Access information for ZOOM meetings are sent via E-Mail.
  • Signup: Contact Lorenz Schmidt

Motivation

Classes teach you all about advanced topics from signal processing, machine learning to virtual acoustics, but one critical subject is rarely covered, and it's instead left to students to figure out on their own: proficiency with their tools.

This workshop teaches you how to master the command-line, automate tasks and collaborate with others through version control systems.

Modules

The first two modules have their focus on basics, mindsets and understanding of design decisions for Bash and Git. They'll give you a basic set of commands and help you of not getting lost in their seemingly complexity. The latter two modules focuses on automation, either by scripting manually or by injecting into a Git workflow. They are useful to establish patterns which support you in your day-to-day work.

1. Unix basics and the shell (Bash)

The session was finished on Nov 03, you can access material by:

Coming from a consumer background the use of a shell can be quite intimidating. You find yourself in a jungle of symbols which may make not much sense to you.

However, getting comfortable with the shell is important for concise and efficient work. The flexibility and information density in the shell cannot be achieved by graphical interfaces.

Unix, designed 40 year ago, has deeply influenced most of today's systems. The concept of small, composable utilities, files and task pipelines are at the heart of using a shell. This module introduces the prompt, paths, access rights, manpages, redirections etc. to work fluently inside a shell. Simple one-line commands are typical in such a setting.

Show table of content
  • what is the shell
  • running single commands to solve simple tasks
  • composing multiple commands to solve complex tasks
  • terminal multiplexing
  • parameterizing commands
  • executing commands on remote machines
  • job control
  • alternative shells

For example, searching through your history quickly can be a huge time saver. In the example below we show a simple trick related to navigating your shell history for converting audio files:

2. Version control (Git)

The session was finished on Nov 10, you can access material by:

Additional links

How to use version control properly, and take advantage of it to save you from disaster, collaborate with others, and quickly find and isolate problematic changes. No more rm -rf; git clone. No more merge conflicts (well, fewer of them at least). No more huge blocks of commented-out code. No more fretting over how to find what broke your code. No more “oh no, did we delete the working code?!”. We’ll even teach you how to contribute to other people’s projects with pull requests!

The module is accompanied by an Anki card deck which helps you retain terminology, commands for most situations and important parameters. You can find it under the heading Accompanying material.

Show table of content
  • basic terms - what are working tree, branch, remote, index, etc.
  • lifecycle of files - what is happening to your files during various operations and where do they go
  • lifecycle of heads - moving around and modifying branch's heads
  • extending the history - commits, three-way merge and why you want to revert sometimes
  • working distributed - working with other people over remotes
  • etiquette - best practices for commit messages, branch names, pull requests
  • seeking help - best resources nowadays for learning advanced Git

In the example below we are rebasing the local master branch onto the remote one:

git-history

3. Automation (Gitlab Runner)

The session was finished on Nov 17, you can access material by:

  • Downloading the slides
  • Reading the documentation of Gitlab Runner
  • You can also ask for the recordings via email

There are two tools that enable you to write and adapt your code with confidence: Code versioning and unit tests. They allow you to track the history of and collaborate on your project, automatically check whether your code still works as expected, and track down bugs if needed.

But these tools are only helpful if you use them consistently. One way of ensuring this consistency is using automation. The most common scenario is to run these tools whenever a changeset is pushed to the central repository, GitLab. GitLab then starts up a job runner that executes any command you want, which could be

  • Running unit tests on your code
  • Generating docs from your code
  • Compiling the code for others
  • Rendering LaTeX documents to PDF
  • and others
Show table of content
  • The runner environment
  • Set up a repo to use automation
  • Generate and publish artifacts
  • Casestudy 1 - Python unit tests
  • Casestudy 2 - Compile LaTeX paper to PDF

The example demonstrates how Tikz is automatically built for a new commit:

4. Shell Scripting (Bash)

The session was finished on Nov 24, you can access material by:

Additional links

You will soon notice that one-liner are not always enough when working in the shell. We will continue where we left in the first module and discuss how to structure commands into a script. This includes arguments and returns, parameters, patterns, conditionals, loops, sourcing and where to seek help. In order to make the content not dry as dust, the module is structured into four scripts, each with increasing complexity. The last one shows you how an audio dataset can be managed with help of a Bash script.

Show table of content
  • script 1 - warmup: the She-Bang, parameters and substitution
  • script 2 - scraping researcher: conditionals and pattern matching
  • script 3 - managing dataset: loops, functions and more substitution

Accompanying material

See also