Lab Book — Week 2

The most exciting thing is that I finally got my new laptop and it’s really a speed boost.

Stack Overflow is a really powerful platform and I can find the solutions to almost all of the problems I encountered. However, you need to judge whether an answer is suitable for your certain situation and select the most appropriate one. I usually see the users’ reputation score and the replies under their answers that whether their solutions worked.

ei. BIOS banned me from opening the virtual box.

In the lecture we learnt the unix commands and the Editor Fu. The hotkeys are quite helpful to speed up scripting.

Unix commands

cd + next directory: go to the next directory

cd ..: go to the parent directory

cd ~: go to the begining

ls: list the file names in the current directory

python + python file: run the file

atom + python file: open the file in atom

pwd: print working directory, figure out where you are

hostname: my computer’s network name

mkdir: make directory

rmdir: remove directory

mv: move a file or directory

pushd: push directory

cp: copy a file or directory

robocopy: robust copy

more: page through a file

type: print the whole file

forfiles: run a command on lots of files

dir -r: find files

select-string: find things inside files

help: read a manual page

helpctr: find what man page is appropriate

echo: print some arguements

set: export/set a new environment variable

exit: exit the shell

runas: DANGER! become super user root DANGER!

Editor Fu

Alt + F3: select all that match

Shift + Alt + up/down arrow: extend cursor

Ctrl + left/right error: Jump to word boundary

Shift + left/right error: select

Ctrl + Shift + left/right error: select to word boundary

Exercise 3 in this week’s homework is quite challenging but I felt good each time my scripts worked. It seems you can write different scripts for the same aim, but you should think which one is the simplest and the most readable way. At the same time, give the variables understandable names and write comments to make sure that next time when you read the script you can still understand what the variables mean or what the functions do.


In the example, the car turns right by n1 degrees if on the left of the road, and turns left by n2 degrees if on the right of the road. We abstract n1 and n2 so that they can be set/reassigned in the future. We can abstract a variable over time to depict a system of all time instead of any particular time.

Coding Games

I like codecombats a lot. It’s a game that you code to let the character collect things and attack enemies. It has problem running on google chrome so I have to switch to firefox. It’s interesting because you have to consider do you collect diamond first or attack enemies first, because you loose blood by being attacked.

Another reason that I like it is because it does not only runs with python. I can also learn other languages and it’s easy to figure out the differences among various languages. I tried JavaScript. It prefers “//” to comment, and wants “;” at the end of command lines.

Show your support

Clapping shows how much you appreciated’s story.