Add all the assignment code.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
58c6b1f81c
commit
cfe502c598
1277 changed files with 48709 additions and 1 deletions
13
hw2/.devcontainer/.zshrc
Normal file
13
hw2/.devcontainer/.zshrc
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
autoload -U colors && colors
|
||||
precmd() {
|
||||
drawline=""
|
||||
for i in {1..$COLUMNS}; drawline=" $drawline"
|
||||
drawline="%U${drawline}%u"
|
||||
PS1="%F{252}${drawline}
|
||||
%B%F{124}%n:%~>%b%f "
|
||||
}
|
||||
|
||||
eval $(opam env)
|
||||
|
||||
alias ls="ls --color"
|
||||
|
||||
73
hw2/.devcontainer/Dockerfile
Normal file
73
hw2/.devcontainer/Dockerfile
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
FROM ubuntu:20.04
|
||||
|
||||
## BEGIN: RUNS AS ROOT
|
||||
|
||||
# Create a user
|
||||
|
||||
ARG USERNAME=cis3410
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
|
||||
ENV TZ='Asia/Shanghai'
|
||||
# !!![zjy] apt change ustc source
|
||||
RUN apt-get update -y\
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
tzdata \
|
||||
&& sed -i "s@http://.*.ubuntu.com@https://mirrors.ustc.edu.cn@g" /etc/apt/sources.list \
|
||||
&& rm -rf /var/apt/cache/*
|
||||
|
||||
RUN groupadd --gid $USER_GID $USERNAME \
|
||||
#
|
||||
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
|
||||
&& apt-get update -y \
|
||||
&& apt-get install -y sudo \
|
||||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
|
||||
&& chmod 0440 /etc/sudoers.d/$USERNAME
|
||||
|
||||
## Hack needs root permissions
|
||||
|
||||
# See hack.sh
|
||||
COPY hack.sh /tmp/hack.sh
|
||||
RUN chmod +x /tmp/hack.sh
|
||||
RUN /tmp/hack.sh
|
||||
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y build-essential
|
||||
RUN apt-get install -y m4
|
||||
RUN apt-get install -y opam
|
||||
RUN apt-get install -y clang
|
||||
RUN apt-get install -y time
|
||||
RUN apt-get install -y zip
|
||||
# !!![zjy] install zsh first then set user
|
||||
RUN apt-get install -y zsh
|
||||
|
||||
# !!![zjy] install zsh first then set user
|
||||
RUN useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/zsh
|
||||
|
||||
## Set up user environmnent
|
||||
COPY .zshrc /home/$USERNAME/
|
||||
RUN chown $USERNAME /home/$USERNAME/.zshrc
|
||||
|
||||
## Run in usermode
|
||||
|
||||
# [Optional] Set the default user. Omit if you want to keep the default as root.
|
||||
USER $USERNAME
|
||||
|
||||
RUN mkdir -p /home/$USERNAME/.local/state/
|
||||
RUN touch /home/$USERNAME/.local/state/utop-history
|
||||
|
||||
# Configure opam/ocaml
|
||||
# !!![zjy] change default repo to github (SJTU repo is failed)
|
||||
RUN opam init --yes --disable-sandboxing default https://github.com/ocaml/opam-repository.git
|
||||
RUN opam switch create 4.14.1 ocaml-base-compiler.4.14.1
|
||||
RUN opam switch 4.14.1
|
||||
RUN opam install -y dune
|
||||
RUN opam install -y num
|
||||
RUN opam install -y menhir
|
||||
RUN opam install -y utop
|
||||
RUN opam install -y ocamlformat
|
||||
RUN opam install -y ocaml-lsp-server
|
||||
RUN eval `opam config env`
|
||||
|
||||
31
hw2/.devcontainer/devcontainer.json
Normal file
31
hw2/.devcontainer/devcontainer.json
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
|
||||
{
|
||||
"name": "Ubuntu",
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "uname -a",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"ocamllabs.ocaml-platform",
|
||||
"allanblanchard.ocp-indent"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
||||
17
hw2/.devcontainer/hack.sh
Normal file
17
hw2/.devcontainer/hack.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
### HACK - workaround ubuntu libc6 version number bug see: https://forum.odroid.com/viewtopic.php?p=344373
|
||||
|
||||
mv /bin/uname /bin/uname.orig
|
||||
tee -a /bin/uname <<EOF
|
||||
#!/bin/bash
|
||||
if [[ \$1 == "-r" ]]; then
|
||||
echo '4.9.250';
|
||||
exit
|
||||
else
|
||||
uname.orig \$1
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod 755 /bin/uname
|
||||
### END HACK
|
||||
Loading…
Add table
Add a link
Reference in a new issue