cs-student / dev-notes Public
+ ▾ Issues Pull requests
cs-student updated dev notes before lab
f8a29b4 2 hours ago

Git Rescue Commands

When you inevitably break the repository right before a deadline, use these.

Undo last commit (keep local changes)

Leaves your working directory exactly as it was, just removes the commit from history.

git reset --soft HEAD~1

Nuclear Option (Wipe everything and match origin)

Warning: This deletes all uncommitted work.

git fetch origin
git reset --hard origin/main

Stash untracked files

git stash -u

URGENT TO-DO

  • Submit OS Assignment 3
  • Figure out why the Docker container keeps crashing on port 8080
  • Email Prof. Davis about midterm grade
  • Finish LeetCode daily problem
  • Buy more coffee

Regex Cheat Sheet (Python)

Quick reference for string parsing.

  • \d - Any digit
  • \w - Alphanumeric + underscore
  • \s - Whitespace
  • + - One or more
  • * - Zero or more

Email Validation (Rough)

import re

pattern = r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"
is_valid = re.match(pattern, "[email protected]")

REST API Endpoints (Local Environment)

Base URL: http://localhost:3000/api/v1

Users Module

  • GET /users - Fetch all users
  • POST /users - Create new user
  • GET /users/:id - Fetch specific user details

Auth Module

  • POST /auth/login - Returns JWT token
  • POST /auth/refresh - Renew token

Note: Need to implement JWT authorization middleware before Friday's capstone demo!

Linux tar Command

I always forget the flags for this.

Create archive

tar -cvf archive_name.tar /path/to/directory

Extract archive

tar -xvf archive_name.tar

Flags explained:

  • -c : Create
  • -x : Extract
  • -v : Verbose (show files being processed)
  • -f : File (specify the filename)
  • -z : Compress with gzip (use .tar.gz extension)