Skip to content

Commit

Permalink
feat(lab00): release
Browse files Browse the repository at this point in the history
  • Loading branch information
Rouxles committed Aug 29, 2024
1 parent 410fe9e commit cba653f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lab00/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def get_airspeed_velocity_of(unladen_swallow):
if unladen_swallow.type == "african":
return # redacted
elif unladen_swallow.type == "european":
return # redacted

# pretend there's code here...

def fizzbuzz(num):
if num == 3: # edit this line
print(f"{num}: fizz")
if num == 5: # edit this line
print(f"{num}: buzz")

for i in range(1, 20):
fizzbuzz(i)

# pretend there's code here...
14 changes: 14 additions & 0 deletions lab00/gen-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

if [[ "$HOSTNAME" == hive* ]]; then
echo "Please run this on your local machine, not a hive machine."
fi

echo "OSTYPE='$OSTYPE'" > debug.txt
echo "BASH_VERSION='$(bash --version 2>&1 | cat)'" >> debug.txt
echo "SH_VERSION='$(sh --version 2>&1 | cat)'" >> debug.txt
echo "GIT_VERSION='$(git --version 2>&1 | cat)'" >> debug.txt
echo "PYTHON3_VERSION='$(python3 --version 2>&1 | cat)'" >> debug.txt
echo "PYTHON_VERSION='$(python --version 2>&1 | cat)'" >> debug.txt
echo "PY_VERSION='$(py --version 2>&1 | cat)'" >> debug.txt
echo "JAVA_VERSION='$(java -version 2>&1 | cat)'" >> debug.txt
19 changes: 19 additions & 0 deletions lab00/get-ssh-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euf -o pipefail

SSH_HOST=${1:-s275-4.cs.berkeley.edu}

for OUTPUT in $(ssh "$SSH_HOST" -G | grep "^identityfile " | cut -d " " -f2-)
do
filename="${OUTPUT/#\~/$HOME}"
if [[ -f $filename ]]; then
echo "You already have an SSH key at: $OUTPUT"
echo "Make note of this, as you'll need this information later!"
exit 0
fi
done

echo "I couldn't find an existing SSH key for you, so let's make one now..."
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ''
echo "Great! Your new SSH key is at: ~/.ssh/id_ed25519"
echo "Make note of this, as you'll need this information later!"
16 changes: 16 additions & 0 deletions lab00/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -eu

lab00_ref="starter/lab00-oski"

git fetch starter

lab00_start_ref="$(git rev-parse "${lab00_ref}~1")"

git tag -f lab00-backup
git push -f origin refs/tags/lab00-backup
git reset --hard "$lab00_start_ref"
git push -f origin "${lab00_ref}:main"
git update-ref refs/remotes/origin/main "$lab00_start_ref" "$lab00_ref"

echo "Finished setup"

0 comments on commit cba653f

Please sign in to comment.