I hereby claim:
- I am Xyene on github.
- I am tbrindus (https://keybase.io/tbrindus) on keybase.
- I have a public key whose fingerprint is A820 1E45 7FA2 F46C 8E6D 64DB 68D2 26AF B0EA 8BAB
To claim this, I am signing this object:
# These instructions assume a clean install of a Debian image from the Windows store | |
sudo mkdir /code | |
sudo chmod 777 /code | |
cd /code | |
sudo apt install -y git vim | |
git clone https://github.com/Xyene/wsl-dotfiles.git | |
cd wsl-dotfiles |
#define MAX_CMDLINE 8191 | |
wchar_t result[MAX_CMDLINE]; | |
memset(result, 0, sizeof(result)); | |
BOOL needquote = FALSE; | |
for (int i = 2; i < argc; i++) { | |
wchar_t *arg = argv[i]; | |
wprintf(L"arg %d = %ls\n", i, arg); |
I hereby claim:
To claim this, I am signing this object:
from piazza_api import Piazza | |
import time | |
import requests | |
import json | |
EMAIL = '[email protected]' | |
PASSWORD = 'hunter2' | |
WEBHOOK_URL = 'https://hooks.slack.com/services/#####/##########' | |
CLASS_NAME = 'CSC209' | |
NETWORK_ID = 'jbcmehb923110u' |
This is the recommended way to run the DMOJ on Windows, but requires the Windows Subsystem for Linux (WSL) that was added in the Windows 10 Anniversary Update. You will need to enable the subsystem before proceeding.
Open Bash by tying bash
in command prompt, or running it directly.
We'll need a couple of packages to get started, after which we can begin setting up the judge.
init.yml specifies signatures for all methods, e.g.:
int findSwapPairs(int, int[], int, int[])
functions:
findSwapPairs: (I[II[I[I[I[I)I
There are two types of functions: functions that the grader calls from C->Java, and functions that Java calls that are implemented in C. The latter is slightly easier to discuss.
We can autogenrate Java classes binding those methods statically, e.g.:
CXX=g++ | |
CXXFLAGS=-g -fPIC -Wall -O3 -march=native -I/usr/include/python$(PYVER) -D_FILE_OFFSET_BITS=64 | |
LIBS=-lrt | |
SOURCES=ptbox.cpp ptdebug.cpp ptdebug32.cpp ptdebug64.cpp ptproc.cpp | |
OBJECTS=$(SOURCES:.cpp=.o) | |
EXECUTABLE=ptbox | |
all: $(SOURCES) $(EXECUTABLE) _cptbox.so | |
$(EXECUTABLE): $(OBJECTS) |
import sys | |
import os | |
from dmoj.wbox.sandbox import WBoxPopen | |
def main(): | |
dir = os.path.dirname(__file__) | |
print ' wbox Test Script' |
import com.sun.jna.Pointer; | |
import com.sun.jna.Structure; | |
import java.io.ByteArrayOutputStream; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.lang.reflect.Field; | |
import java.util.*; | |
import java.util.concurrent.atomic.AtomicInteger; |
import ctypes | |
from ctypes.wintypes import * | |
from ctypes import * | |
# Standard colours | |
FOREGROUND_BLUE = 0x0001 | |
FOREGROUND_GREEN = 0x0002 | |
FOREGROUND_RED = 0x0004 | |
FOREGROUND_INTENSITY = 0x0008 | |
BACKGROUND_BLUE = 0x0010 |