We will be using a wide variety of remote tools for class. We will still use the CS lab machines to host content and provide various tools specific to the course. Many of these tools can be replicated on your local machine, but providing tech support for the wide varieties of operating systems and hardware configurations is beyond the scope of this course. It is my hope and goal that a few primary tools can be downloaded to your local machine that can create an environment for successfully completing this course and collaborating with others.

Remote Communication

We will primarily using Slack and Zoom for classes, labs, and office hours.

Slack

You will receive an email invitation to join the class slack page prior to the start of the semester. Please sign in prior to the start of class.

Navigating Slack

Slack breaks up workspace into channels, which are listed in the sidebar on the left. Some channels we will use in this course are:

#general for general announcements about the class. You can select pinned announcements to find common links and notes.

#office-hours for class office hours. You can send a quick message to me here and start a zoom session when we are both available.

#labNN we will often move to slack after starting each lab session on the course zoom page. Here you can get individual help on your lab work, and I’ll check in with each lab group. You can type in short questions, but typically we will have you start a /zoom session to which we will attach.

Start Zoom from Slack

First choose the slack channel for the type of session (lab or office hours), and check for my availability. To start a zoom session just type /zoom. If you are working on a partnered lab one of you or your partner can start, and the other can join.

In zoom you can share your screen to display and run your code, or display your homework to your instructor.

Accessibility

Swarthmore is committed to making all course material accessible to you. To access Slack’s accessibility settings, start by clicking on the workspace name at the top of the navigation pane on a laptop or desktop.

Then from the dropdown menu choose "Preferences", then select "Accessibility" from the navigation bar on the left.

Options include:

  • Content magnification ("Zoom"). Allows you to enlarge content shown in Slack

  • Animation. Please uncheck this box if you are sensitive to animated images.

  • Keyboard. Options for non-mouse navigation.

Direct Messaging

By default, messages posted on Slack are visible to all members of the workspace. But for smaller conversations, you can use Slack’s direct messaging (DM) feature to start a private conversation with one person or a small group.

Code of Conduct

The course Slack workspace is accessed by a wide variety of people all working in different environments and time zones. We ask that you be respectful of the staff as well as your fellow students. We expect you to follow these general rules:

  • Do not use Slack to harass faculty, staff, or other students.

  • Do not spam any channels or direct messages. Try to make posts in academic channels concise and on-topic

  • Follow channel guidelines, e.g., do not post idle conversations in the #labNN channel.

  • Respect others’ time. When you are in lab, or in office hours, try to respond promptly to messages directed to you.

  • Note that any messages you post in a channel will be visible to everyone in that channel. Think before you post!

If there is a problem where someone is violating the code of conduct or otherwise failing to respect others, please raise the issue to the instructor.

Zoom

You will receive an email with information about how to find our class zoom link before the start of class.

There are instructions for using zoom off the college’s Working Remotely page.

Zoom with a Partner

Set-up and try out a zoom meeting with your lab partner or project group members

  1. One of you should create a zoom meeting for your lab work:

    • Name the meeting something like labXmeeting where X is the number of your lab assignment

    • Make it a Recurring meeting with the Recurrence→No Fixed Time option.

    • Enable join before host in the Meeting options

    • Save and send your lab partner the zoom link (Join URL associated with your meeting or copy the invitation link)

  2. Contact each other to find a time for a 10 minute practice zoom meeting.

  3. At the time you arranged to meet, join your zoom meeting (because "join before host" is selected any of you can start the meeting).

Connecting to CS

ssh

ssh is useful for remotely logging into the CS lab machines. scp is useful for copying files between your local system and the CS system.

ssh usage

You can remotely connect to any machine by sshing in as you to lab.cs.swarthmore.edu or to a particular machine by logging in as you to a specific machinename.cs.swarthmore.edu. For example:

# log into some lab machine:
ssh yourusername@lab.cs.swarthmore.edu

# log into owl:
ssh yourusername@owl.cs.swarthmore.edu

You can find the names of lab machines here: cs lab machines

scp

scp is like the cp command, but for copying files between two different machines.

# copy a file named "bio.txt" from the "cs40/labs/lab01" directory on a lab machine to your machine
scp yourusername@cs.swarthmore.edu:cs40/labs/lab01/bio.txt .

# copy a file named "bio2.txt" from current directory on your machine onto a lab machine
# Note: by default, this will place the file in your home directory; i.e.,  "/home/yourusername"
scp bio2.txt yourusername@cs.swarthmore.edu:

# copy a file named "bio3.txt" from current directory on your machine
# onto a lab machine in the "cs40/labs/lab01" directory
scp bio3.txt yourusername@cs.swarthmore.edu:cs40/labs/lab01

tmux

tmux (and screen) are used to start sessions on a machine that you can detach from and keep running when you log out and then re-attach to later.

tmux is particularly useful for setting up an environment for remote lab work on a particular CS lab machine. You can then detach from the tmux session and logout, and later ssh back into the machine, re-attach to the tmux session and continue from where you left off.

tmux is also handy in that it allows you to create multi-panned windows in a single tmux session. For code development is it nice to have at least two panes: one for editing the file, and another for compiling and running. The CS department help pages has some information for getting started using tmux: CS help tmux page. Here, also, are a few basics:

## tmux commands from bash shell

$ tmux        # create a tmux session
$ tmux attach # attach to an existing tmux session
$ tmux ls     # list existing tmux sessions
$ tmux attach -t sessionname # attach to tmux session named sessionname
$ tmux kill-session -t sessionname # kill tmux session named sessionname


## tmux commands from within a session CNTRL-b initiates these
## first type CNTRL-b then one of the following keys to do:

CNTRL-b d             # detach from the current session
CNTRL-b an_arrow_key  # to move to a different pane within a session
CNTRL-b :             # get tmux prompt to enter all kinds of commands
                      # (ex. to create and configure panes)

Scrolling and copy/paste within a pane is a bit weird. Here are some commands for doing both:

# to scroll within a pane:
CNTRL-b [             # then use page-up and page-down to scroll in pane

# to copy from one pane only:
CNTRL-b [             # to copy from a pane:
  space               # start copying from curser
                      # move curser to end of what you want to copy
  enter               # stop copying at curser

# to paste into same or different pane (be in insert mode if pasting in vim):
CNTRL-b ]             # paste

Custom tmux sessions

It is often useful to write a bash script for creating a tmux session with a regularly used tmux set-up. Professor Newhall has an example script (mytmux.sh). that sets up a tmux session with 3 panes. It is designed to be useful for code development and testing, where the left-most pane can be used to run an editor (e.g. vim) to edit a source code file, and the right panes are useful for compiling, running, debugging, and other purposes. The script, when run, produces a tmux session that looks like this:

tmux example with 3 panes

  • you can run the script directly like this to start your own tmux session using this configuration:

    ~newhall/bin/mytmux.sh
  • or you can copy it over into your home directory, and edit as you’d like, and run it to start your own custom tmux session (really 2 panes might be enough and easier to manage):

    cd
    cp ~newhall/bin/mytmux.sh .
    chmod 700 mytmux.sh    # set this to executable
    ./mytmux.sh
    
    # open in an editor (vim, emacs, ...) to edit the file to customize
    # in a different way (we find that 2-3 panes is useful, and more than
    # that starts to make the session more difficult to use):
    vim mytmux.sh
avoid leaving old tmux sessions running

When using tmux (and screen), be careful about not leaving a lot of old sessions of yours running on lab machines. If you ssh into a particular machine each time you run tmux or screen (ssh you@machinename.cs.swarthmore.edu), this is one way to avoid leaving one running on a machine that you forget about.

Finding idle machines

If you are connected to a lab machine via ssh and notice that it is running slowly, or not responding well, you will want to find a better machine to use.

Here are few utilities to see what is running on a machine and to help you find another machine that will respond better and ssh into that one instead.

who, top, htop

First, you can run who to see if there are a lot of other users logged into the same machine as you are:

who

If there are a lot of users logged into a machine, it may be one that could become overloaded. If all the users are idle, however, it will not be.

A better way to see real cpu and memory load on a machine is to run top and htop. htop has nicer output, so I’d recommend that:

htop

htop shows CPU usage on each core, maybe 1-12 on one of the lab machines, Mem usage, and Swp usage. If the CPU and/or Mem usage is high, and particularly if the machine is Swapping (Swap is active), you want to pick another lab machine to use. Here is some more information about using top and htop

smarterSSH

smarterSSH can be used to ssh into a machine that has a lot more available RAM and CPU resources, and should perform well. Running it directly will ssh you in to a good machine, but you may want to run using the -i command line option to list the top machines, then exit the slow machine (kiling any tmux sessions on it first), and then directly ssh into it from home.

Here is the way you may want to run smarterSSH:

smarterSSH -i  -v -n 20

This lists the best 20 machines in terms of available RAM and CPU. Choose one of the machines listed to ssh into (you don’t always want to pick the top one, as maybe others are also choosing it, but if you select one in the top 10 or so, it should perform well)

Here are some other sample line options for using smarterSSH:

# directly ssh's you into one of the best machines
smarterSSH

# list the command line options
smarterSSH -h

# lists top 50 machines based on their available RAM
# probably want the default that orders based on a function of RAM and CPU
smarterSSH -i  -v -n 50 -m

# lists top 50 machines based on their available cpu
smarterSSH -i  -v -n 50 -c

System dashboard

You could also look at the status dashboard off the CS department machines page to try to find a machine that looks less loaded.

Tools for lab work

We’ll be using a mix of Slack and Piazza for answering questions. Short term announcements, short questions, or in course/lab conversations will happen in Slack. For longer form questions, please use Piazza.

Swarthmore’s Github Enterprise server (GHE) will host code assignments and demos.

You may want to review the using git instructions and links to help you get and submit your lab assignments.

Our git help pages have more general details on using git.

Editors/SSHFS

You are free to use whatever editor you choose. I recommend using either vim or visual studio code.

If you are running a graphical editor like VS Code or atom locally on your personal computer. You may want to use SSHFS to mount your CS files as a local drive on your computer for easier editing.

General