Skip to content

Instantly share code, notes, and snippets.

View addcninblue's full-sized avatar
🌴
hello

Addison Chan addcninblue

🌴
hello
View GitHub Profile

Explanation for str, repr, and the REPL:

You can memorize these two rules, and everything will be merry and well.

Rule 1:

When you see

>>> EXPR

you can think of this as doing exactly the following (for the purposes of 61A):

@addcninblue
addcninblue / downgrade.sh
Created September 18, 2021 21:39
Script to downgrade Remarkable version. Please reference https://github.com/ddvk/remarkable-update
#!/bin/bash
# Usage:
# SERVER=LINK_TO_YOUR_SERVER ./downgrade.sh
REMARKABLE_UPDATE="/usr/share/remarkable/update.conf"
REMARKABLE_UPDATE_BKUP="/tmp/update_bkup.conf"
# Copy Remarkable update file
cp $REMARKABLE_UPDATE $REMARKABLE_UPDATE_BKUP
@addcninblue
addcninblue / okpy.md
Last active August 30, 2018 22:53
Okpy

Getting around the time limit

Background

Okpy is an autograderused in Berkeley's CS61A course. There is a built-in velocity limiter that prevents students from checking their work too often, which would end up with counterproductive behavior (ie. changing every line and rerunning the autograder, hoping they stumble upon the mistake). I looked into the velocity limitation implementation, and reverse engineered it.

Workarounds

My initial workaround to this problem was to use the linux command sleep which would sleep for a given number of seconds and then run a command. (The full command was sleep 60s && python3 ok.) This worked in that I didn't have to keep running the autograder to see the time remaining, but I still had the 1 minute lock nonetheless. I wanted to find a better way.

Clues

My first thought that there could be a better way came when a student had a problem regarding ok (he had nearly infinite remaining time — a weird bug). An instructor suggested to remove a file on his local ma

How I got around Berkeley's Okpy time limit system

Background / Motivation

Berkeley's Okpy is an autograder that grades students' code. A student can use it as many times as he/she wants, but there's a catch: the student must wait for one minute before the next try. This was really annoying to deal with, because sometimes it would just be a typo or a missed parentheses. Thus, we as students naturally wanted to get around it somehow.

Workarounds

My initial workaround to this problem was to use the linux command sleep which would sleep for a given number of seconds and then run a command. (The full command was sleep 60s && python3 ok. This worked in that I didn't have to keep running the autograder to see the time remaining, but I still had the 1 minute lock nonetheless. I wanted to find a better way.

Clues

My first thought that there could be a better way came when a student had a problem regarding ok (he had nearly infinite remaining time — a weird bugj). An instructor suggested to remove a

public class main {
public static void main (String [] args){
Robot robot;
robot = new Robot(new int[]{1,1,2,2}, 1, true);
checkEquals(robot.clearHall(), 9, 5);
robot = new Robot(new int[]{1,1,2,2}, 1, false);
checkEquals(robot.clearHall(), 8, 8);
robot = new Robot(new int[]{1,1,1,1}, 0, true);