Discuss with your group:
Write down your answers (and why you chose them!) in your group’s shared doc.
There are many things we can do to speed up working with the command line, making it more efficient and easy to use. Working quickly can dramatically change how difficult future programming tasks are for you, so it’s worth spending time getting better at using your tools.
In this lab, you’re going to learn how to make this process a lot easier for you. Then, you will compete in small teams against your peers to see who can accomplish the given command line tasks most efficiently - and maybe pick up some winners’ tricks along the way.
These are the tasks you will be timing yourself on. As setup, Make a fork of the lab 7 repo on your Github account, so it starts as an exact copy of our repository. Before timing yourself again, make sure to delete and re-fork the repository so you’re starting from a clean state. The TAs were able to get under 5 minutes after a couple of tries.
So a run through this process will look like this. Don’t do it just yet, though. There’s a little bit of setup involved.
With the setup we’ve used so far this quarter, each time you log in to your course-specific account, you have to type the password. You might have noticed that during the skill demonstration you didn’t have to type the password for our instructor accounts! Here, you’ll learn how to configure that for yourself (it will save lots of time).
ssh-keygen
<Enter>
until the program shows some text it calles the “randomart image”.ieng6
mkdir .ssh
in the terminal.ssh
directory you just created, in a file called authorized_keys
.Your public key has been saved in: <path to your public SSH key>
, copy the path. Make sure you get the public key file, ending in .pub
, here, not the private file.scp <path to your public SSH key> cs15lwi23__@ieng6.ucsd.edu:~/.ssh/authorized_keys
You can access and write data in repositories on GitHub.com using SSH. When you connect via SSH, you authenticate using a private key file on your local machine, which in our case will be the ieng6 machine.
Create a private SSH key file in ieng6. This is a new private key just for accessing Github from your course-specific account.
ssh-keygen
, and again press Enter until the command completes and shows the “randomart image”Next, we want to add a the public key to your Github account. This is like the step of copying the public key to authorized_keys
on ieng6
, but instead we’re copying to Github.
cat
like below; you can copy it by highlighting and right-clickingcat <path of your ssh key .pub file>
cat
command and paste it into the “Key” fieldGo back to the ieng6
terminal and:
$ ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
>>
means “append stdout of the command to file”$ ssh -T git@github.com
Now we have an SSH key which can be used to authenticate to GitHub! In addition to using https
clone URLs, we can now use SSH
clone URLs that look like this:
Crucially, these will allow both cloning and pushing to the repository (as long as your account has access). With this done, try cloning your fork of the lab 7 repository (make a fork if you didn’t already), then making a small change, and pushing it with the command line.
If you’re not sure how to add, commit, and push from the command line, refer to the lecture video from Monday.
Make sure you can make a change to your repository by editing, adding, and pushing all from the command line before going on!
Before you (potentially) race against others, you are going to see how much you can improve your own time. So you’ll first take a baseline measurement of performing the tasks above by timing yourself. Your phone may have a timer app, or you can find one by searching for online timers. The steps from above are duplicated here:
Write down in notes: What was your baseline time? Did your lab partner have a faster baseline than you? If so, do they have any tips to help you get started on boosting your efficiency?
Now, you will explore various ways that you can speed up your work. Try all the steps below, and find out what works best (and what doesn’t work) for you!
Ctrl-U
deletes everything from the current cursor position to the beginning of the lineCtrl-K
deletes everything from the current cursor position to the end of the lineCtrl-A
goes back to the beginning of the lineCtrl-E
goes to the end of the lineCtrl-W
deletes the last wordAlt-Left
/Alt-Right
(Windows) or Option-Left
/Option-Right
(Mac) to move by wordAlt+Shift-Left/Alt+Shift-Right
(Windows) or Option+Shift-Left/Option+Shift-Right
(Mac) - select multiple wordsCommand-C
to copyCommand-V
to pasteCtrl-C
to copyCtrl-V
to pasteAfter practicing with the above, time yourself again doing the same tasks. Don’t forget to delete and re-fork the repository before timing!
Write down in notes: How much were you able to improve from your baseline?
Now, it’s time to race your peers in small groups! By the end of lab, only one lab group will come out on top.
Within your group, anyone who wants to be a contestant in the CLDQ championship should have an initial race.
Have someone start a timer and say “go” (make sure you have a fresh fork, etc, before starting!), and race the others in your group to finish. Whoever goes fastest in your group will be the representative of your group in the Aisle stage.
There are 20 total minutes for this stage. After you select the champion, the whole group should work together to think of ways to speed up their process. All members should help the champion to prepare for the competition. Look at their preferences, and make any suggestions that you think could speed them up even more (make sure to have them try, first).
Write down in notes: Who was the champion of your team to compete in the first round? Did you make any last minute changes to their plan before the aisle race?
In this round, your tutor will organize you and give you the signal to start the clock! Race against the lab group next to you.
Then, after you have the winner, the whole aisle should work together to suggest improvements for the final round across lab aisles. Take 5-10 minutes to do this.
Write down in notes: Who was the champion of your aisle in the first round? Did you make any last minute changes to their plan before the aisle race?
For the final round, the course staff will help organize the 2-4 champions from the aisle for optimal comparison. Pay attention to their instructions to get set up, and wait for their signal to get started.
The winner of each lab room will get a full pass on their second skill demo…. most likely. Not officially as a prize or anything. It’s just a good signal that they’ll succeed at skill demonstrations.
Write down in notes:
(The “Done Quick” naming scheme is from a charity video game marathon called Awesome Games Done Quick)
For the lab report this week, reproduce the task from the competition on your own. For each numbered step starting right after the timer (so steps 4-9), take a screenshot, and write down exactly which keys you pressed to get to that step. For special characters like <enter>
or <tab>
, write them in angle brackets with code formatting. Then, summarize the commands you ran and what the effect of those keypresses were.
For example, when you run the tests, you might want to use the up arrow or Ctrl-R to access your bash history rather than typing in the full command with classpath, etc. You might say something like this accompanying the screenshot for running the tests:
Keys pressed:
<up><up><up><up><enter>
,<up><up><up><up><enter>
The
javac -cp .:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar *.java
command was 4 up in the search history, so I used up arrow to access it. Then thejava -cp .:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar org.junit.runner.JUnitCore
command was 4 up in the history, so I accessed and ran it in the same way.
Add this lab report to your Github Pages site, and submit a PDF of it as usual.