Last active
January 8, 2021 21:57
-
-
Save dcmcand/726aa137f26c84c7ff62835b8eb262f3 to your computer and use it in GitHub Desktop.
Homework grading script that adds homework to grading ami and opens visual studio code using sshfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# First click the link to download the zip file. It goes to ~/Downloads. | |
# This script requires SSHFS and VSCode to be installed | |
# Please replace username with your github username | |
# Now run grade.sh <submission number> | |
# Switch to ssh session | |
# cd <submission number> | |
# Evaluate! Code will be loaded using sshfs in VScode. Read code and comments in your editor. Run code in ssh session. Any edits you make in your editor will be reflected in the ssh session. | |
username="GITHUB_USERNAME" | |
submission=$1 | |
if ! command code -v &> /dev/null | |
then | |
echo "Please install Visual Studio Code" | |
exit | |
fi | |
if ! command sshfs -h &> /dev/null | |
then | |
echo "Please install SSHFS" | |
exit | |
fi | |
if [ -f ~/Downloads/$submission.zip ] | |
then | |
function cleanup { | |
echo "Cleaning up" | |
umount ~/remote | |
rmdir ~/remote | |
ssh homeworkgrading.com -C "rm -rf ~/$submission" | |
} | |
trap cleanup EXIT | |
ssh homeworkgrading.com -C "mkdir -p ~/$submission" | |
scp ~/Downloads/$submission.zip homeworkgrading.com:~ | |
## If you want the script to remove the downloaded zip from your machine, uncomment the following line. | |
# rm ~/Downloads/$submission.zip | |
ssh homeworkgrading.com -C "unzip ~/$submission.zip -d ~/$submission" | |
ssh homeworkgrading.com -C "rm ~/$submission.zip" | |
mkdir ~/remote | |
sshfs homeworkgrading.com:/home/$username/$submission ~/remote | |
code ~/remote | |
ssh homeworkgrading.com | |
else | |
echo "Could not find that assignment. Please download the zip to $HOME/Downloads/" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment