Skip to content

Commit e3536e0

Browse files
committed
first commit
0 parents  commit e3536e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+476633
-0
lines changed

.github/workflows/autograders.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This job updates the autograders on every push to main.
2+
# Autograders are stored in `admin/autograders` in the CS106L AFS directory.
3+
4+
name: Update Autograders
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
15+
# This line prevents this action from running in forks of the repository
16+
if: github.repository == 'cs106l/cs106l-assignments'
17+
18+
steps:
19+
- name: Deploy to AFS
20+
env:
21+
TOKEN: ${{ secrets.DEPLOY_TOKEN }}
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
curl -X POST "https://web.stanford.edu/class/cs106l/cgi-bin/deploy/?name=autograders" \
25+
-H "Token: $TOKEN" \
26+
-H "Github-Token: $GH_TOKEN" \
27+
--fail-with-body

.gitignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Solution files
2+
*.soln
3+
4+
# Prerequisites
5+
*.d
6+
7+
# Compiled Object files
8+
*.slo
9+
*.lo
10+
*.o
11+
*.obj
12+
13+
# Precompiled Headers
14+
*.gch
15+
*.pch
16+
17+
# Compiled Dynamic libraries
18+
*.so
19+
*.dylib
20+
*.dll
21+
22+
# Fortran module files
23+
*.mod
24+
*.smod
25+
26+
# Compiled Static libraries
27+
*.lai
28+
*.la
29+
*.a
30+
*.lib
31+
32+
# Executables
33+
*.exe
34+
*.out
35+
*.app
36+
main
37+
38+
# Python
39+
__pycache__/
40+
*.whl
41+
42+
# Virtualenv
43+
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
44+
.Python
45+
[Bb]in
46+
[Ii]nclude
47+
[Ll]ib
48+
[Ll]ib64
49+
[Ll]ocal
50+
[Ss]cripts
51+
pyvenv.cfg
52+
.venv
53+
pip-selfcheck.json

.vscode/settings.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"C_Cpp.clang_format_fallbackStyle": "{ PointerAlignment: Left, ColumnLimit: 100 }",
3+
"files.associations": {
4+
"__bit_reference": "cpp",
5+
"__hash_table": "cpp",
6+
"__locale": "cpp",
7+
"__node_handle": "cpp",
8+
"__split_buffer": "cpp",
9+
"__threading_support": "cpp",
10+
"__tree": "cpp",
11+
"__verbose_abort": "cpp",
12+
"array": "cpp",
13+
"bitset": "cpp",
14+
"cctype": "cpp",
15+
"clocale": "cpp",
16+
"cmath": "cpp",
17+
"complex": "cpp",
18+
"cstdarg": "cpp",
19+
"cstddef": "cpp",
20+
"cstdint": "cpp",
21+
"cstdio": "cpp",
22+
"cstdlib": "cpp",
23+
"cstring": "cpp",
24+
"ctime": "cpp",
25+
"cwchar": "cpp",
26+
"cwctype": "cpp",
27+
"deque": "cpp",
28+
"execution": "cpp",
29+
"memory": "cpp",
30+
"fstream": "cpp",
31+
"initializer_list": "cpp",
32+
"iomanip": "cpp",
33+
"ios": "cpp",
34+
"iosfwd": "cpp",
35+
"iostream": "cpp",
36+
"istream": "cpp",
37+
"limits": "cpp",
38+
"locale": "cpp",
39+
"mutex": "cpp",
40+
"new": "cpp",
41+
"optional": "cpp",
42+
"ostream": "cpp",
43+
"print": "cpp",
44+
"queue": "cpp",
45+
"ratio": "cpp",
46+
"set": "cpp",
47+
"sstream": "cpp",
48+
"stack": "cpp",
49+
"stdexcept": "cpp",
50+
"streambuf": "cpp",
51+
"string": "cpp",
52+
"string_view": "cpp",
53+
"tuple": "cpp",
54+
"typeinfo": "cpp",
55+
"unordered_map": "cpp",
56+
"unordered_set": "cpp",
57+
"variant": "cpp",
58+
"vector": "cpp",
59+
"algorithm": "cpp"
60+
}
61+
}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CS106L Assignments
2+
3+
This repository contains starter code for Stanford CS106L, a course on Standard C++ programming.
4+
5+
To get started, [follow the setup instructions in A0](/assign0/README.md)!

admin.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import subprocess
2+
import os
3+
import argparse
4+
5+
6+
def find_last_commit_with_path(path):
7+
if os.path.exists(path):
8+
raise ValueError(f"Path {path} already exists!")
9+
try:
10+
# This gives us the hash that deleted the file
11+
commit_hash = subprocess.check_output(
12+
["git", "log", "-n", "1", "--pretty=format:%H", "--", path],
13+
).decode("utf-8").strip()
14+
15+
# This gives us the hash before that one
16+
commit_hash = subprocess.check_output(
17+
["git", "log", "-n", "1", "--pretty=format:%H", f"{commit_hash}^"],
18+
).decode("utf8").strip()
19+
20+
return commit_hash
21+
except subprocess.CalledProcessError:
22+
return None
23+
24+
def copy_from_commit(commit_hash, path):
25+
os.makedirs(path, exist_ok=True)
26+
subprocess.run(["git", "checkout", commit_hash, "--", path])
27+
28+
29+
def main():
30+
parser = argparse.ArgumentParser(description="Copies an old assignment into the worktree.")
31+
parser.add_argument("assignment", help="An assignment, e.g. 'assign0', 'assign1', etc.")
32+
args = parser.parse_args()
33+
34+
path = args.assignment
35+
commit_hash = find_last_commit_with_path(path)
36+
37+
if commit_hash:
38+
print(f"Last commit for {path}: {commit_hash}")
39+
copy_from_commit(commit_hash, path)
40+
print(f"Copied {path} from commit {commit_hash}.")
41+
else:
42+
print(f"No commits found for the specified assignment: {path}.")
43+
44+
main()

0 commit comments

Comments
 (0)