Created
February 18, 2023 07:26
-
-
Save MaddyGuthridge/c5a93bf28e8c592a8782e203f7e2c0b9 to your computer and use it in GitHub Desktop.
Helpful aliases and functions for working locally at UNSW CSE
This file contains hidden or 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
# Copy this into your .bashrc or .zshrc | |
# To make this even nicer, use `ssh-copy-id` so you don't need to use your password for everything | |
# UNSW zID | |
export ZID="z5312085" | |
# Environment variables pointing to CSE Servers | |
export CSE="${ZID}@login.cse.unsw.edu.au" | |
# Quick alias for SSH-ing into CSE | |
alias cse="ssh $CSE" | |
# Quick function for grabbing files from CSE | |
# | |
# cse-get /path/to/my/file.txt | |
# Download to ./file.txt | |
# | |
# cse-get /path/to/my/file.txt /path/to/save/in.txt | |
# Download to in.txt | |
# | |
# Note that using the ~ character won't work correctly on the CSE end | |
cse-get() | |
{ | |
if [ $# -eq 1 ]; then | |
echo "CSE: Downloading $1 -> ${1##*/}" | |
rsync "$CSE":"$1" ${1##*/} | |
elif [ $# -eq 2 ]; then | |
echo "CSE: Downloading $1 -> $2" | |
rsync "$CSE":"$1" $2 | |
else | |
echo "Usage: cse-get from_file [to_file]" | |
fi | |
} | |
# Quick function for sending files to CSE | |
# | |
# cse-set /path/to/my/file.txt | |
# Upload to your CSE home directory as file.txt | |
# | |
# cse-set /path/to/my/file.txt /path/to/save/in.txt | |
# Upload to CSE systems under the given path | |
# | |
# Note that using the ~ character won't work correctly on the CSE end | |
cse-set() | |
{ | |
if [ $# -eq 1 ]; then | |
echo "CSE: Uploading $1 -> ${1##*/}" | |
rsync ${1##*/} "${CSE}:/home/${ZID}/${1}" | |
elif [ $# -eq 2 ]; then | |
echo "CSE: Uploading $1 -> $2" | |
rsync $1 "$CSE":"$2" | |
else | |
echo "Usage: cse-set from_file [to_file]" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment