This Is Not The Course Website You Are Looking For

This course website is from a previous semester. If you are currently in the class, please make sure you are viewing the latest course website instead of this old one.

Everyone:

Next week, we will review for the upcoming Exam 01, which will cover everything from utilizing git, using the shell, scripting the shell, constructing pipelines with filters, and wielding regular expressions.

Because of the exam on Friday, March 05, there will be no homework for the upcoming week.

TL;DR

The focus of this reading is to review for the upcoming Exam 01.

Readings

The readings for this week are:

  1. Checklist 01:

    This is a non-exhaustive though mostly complete overview of the terms, concepts, and skills you should know for the upcoming exam.

Optional Resources

On Wednesday, we will begin our transition to Python. If you wish to get ahead on snake wrangling, you may wish to begin reading the following:

  1. Scipy Lecture Notes: 1.2. The Python language

    This provides a brief overview of the Python programming language.

If you wish for more in-depth material about Python, you can also reference the following resources:

  1. A Byte of Python

  2. Automate The Boring Stuff

Quiz

This week, your reading quiz is split into two sections: the first part is your normal dredd quiz, while the second part involves a series of pipelines. The questions are based heavily on Checklist 01.

Questions

Record the answers to the following Reading 04 Quiz questions in your reading04 branch:

Filters

For the second part, given the following data about the Teenage Mutant Ninja Turtles:

Leonardo:blue:katana
Donatello:purple:bo
Raphael:red:sai
Michelangelo:orange:nunchucks

You are to complete the following pipelines:

  1. List only the names of the turtles in sorted order.

    $ curl -sL https://yld.me/raw/lE8 | ...
    Donatello
    Leonardo
    Michelangelo
    Raphael
    
  2. List only the colors of the turtles in all capitals.

    $ curl -sL https://yld.me/raw/lE8 | ...
    BLUE
    PURPLE
    RED
    ORANGE
    
  3. Replace all weapons with plowshares

    $ curl -sL https://yld.me/raw/lE8 | ...
    Leonardo:blue:plowshare
    Donatello:purple:plowshare
    Raphael:red:plowshare
    Michelangelo:orange:plowshare
    
  4. List only the turtles whose names end in lo.

    $ curl -sL https://yld.me/raw/lE8 | ...
    Donatello
    Michelangelo
    
  5. List only the turtles with names that have two consecutive vowels.

    $ curl -sL https://yld.me/raw/lE8 | ...
    Leonardo
    Raphael
    
  6. Count how many colors don't begin with a vowel

    $ curl -sL https://yld.me/raw/lE8 | ...
    3
    
  7. List only the turtles names whose name ends with a vowel and whose weapon ends with a vowel.

    $ curl -sL https://yld.me/raw/lE8 | ...
    Leonardo
    Donatello
    
  8. List only the colors of the turtles whose name has two of the same consecutive letter (i.e. aa, bb, etc.)

    $ curl -sL https://yld.me/raw/lE8 | ...
    purple
    

Template

To record your pipelines, you will need to write your answers to the filters.sh script:

# Download filters template
$ curl -LO https://raw.githubusercontent.com/nd-cse-20289-sp21/cse-20289-sp21-assignments/master/reading04/filters.sh

Each question has a corresponding function; for instance, the solution for Question 1 should be recorded in q1_answer:

#!/bin/bash

q1_answer() {
    # TODO: List only the names of the turtles in sorted order.
    curl -sL https://yld.me/raw/lE8 | ...
}

To construct your pipelines, you should try them interactively in your shell. Once you found a reasonable solution, you can record them in the filters.sh script under the appropriate function.

Makefile

To test your pipelines, you need to download the Reading 04 Makefile, which in turn will download the test_filters.sh test script and execute it:

# Download Makefile
$ curl -LO https://raw.githubusercontent.com/nd-cse-20289-sp21/cse-20289-sp21-assignments/master/reading04/Makefile

# Download test scripts and run test
$ make
...

# Test your filters
$ ./test_filters.sh
Testing filters.sh ...
     Q1 Success
     Q2 Success
     Q3 Success
     Q4 Success
     Q5 Success
     Q6 Success
     Q7 Success
     Q8 Success
  Score 1.00

Submission

To submit you work, follow the same process outlined in Reading 01:

$ git checkout master                 # Make sure we are in master branch
$ git pull --rebase                   # Make sure we are up-to-date with GitHub

$ git checkout -b reading04           # Create reading04 branch and check it out

$ cd reading04                        # Go into reading04 folder
$ $EDITOR answers.json                # Edit your answers.json file

$ ../.scripts/check.py                # Check reading04 quiz
Checking reading04 quiz ...
      Q1 0.40
      Q2 0.40
      Q3 0.40
      Q4 0.40
      Q5 0.30
      Q6 0.30
      Q7 0.40
      Q8 0.40
   Score 3.00 / 3.00
  Status Success

$ git add answers.json                # Add answers.json to staging area
$ git commit -m "Reading 04: Quiz"    # Commit work

$ $EDITOR filters.sh                  # Edit your filters.sh file

$ ./test_filters.sh                   # Test your filters
Testing filters.sh ...
     Q1 Success
     Q2 Success
     Q3 Success
     Q4 Success
     Q5 Success
     Q6 Success
     Q7 Success
     Q8 Success
  Score 1.00

$ git add Makefile                    # Add Makefile to staging area
$ git add filters.sh                  # Add filters.sh to staging area
$ git commit -m "Reading 04: Filters" # Commit work

$ git push -u origin reading04        # Push branch to GitHub

Pull Request

Remember to create a Pull Request and assign the appropriate TA from the Reading 04 TA List.

DO NOT MERGE your own Pull Request. The TAs use open Pull Requests to keep track of which assignments to grade. Closing them yourself will cause a delay in grading and confuse the TAs.