-
Notifications
You must be signed in to change notification settings - Fork 0
Just for code review #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
maVovk
wants to merge
1
commit into
empty_branch
Choose a base branch
from
master
base: empty_branch
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| /target | ||
| /.vscode | ||
| /.vscode | ||
| /testing_staff |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| [package] | ||
| name = "casino_contest" | ||
| name = "easy_contest" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
|
|
||
| [features] | ||
| root=[] | ||
|
|
||
| [dependencies] | ||
| nix = "0.29.0" | ||
| libc = "0.2.172" | ||
| nix = "0.30.1" | ||
| shellexpand = "3.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||
| [растпобеда.рф](https://растпобеда.рф) | ||||||
|
|
||||||
| # **EasyContest** | ||||||
| EasyContest - one day this will be a selfmade programming contest platform focused on ease of use and extendability, but now it's just beginning) | ||||||
|
|
||||||
| ## Container module | ||||||
| Incapsulates running compiled executables in separate "container jail" with limited resources and permissions. Right on only statically linked binaries supported. | ||||||
|
||||||
| Incapsulates running compiled executables in separate "container jail" with limited resources and permissions. Right on only statically linked binaries supported. | |
| Incapsulates running compiled executables in separate "container jail" with limited resources and permissions. Right now, only statically linked binaries are supported. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| RAM_LIMIT=# memory limit in B, MB, KB, GB | ||
| CPU_LIMIT=# cpu limit in percents (optional, 100% by default) | ||
| TIME_LIMIT=# time limit in seconds (optional, no limit by default) | ||
| JAIL_DIR=# directory to store container jails | ||
| EXE_PATH=# path to the compiled, statically linked executable | ||
| STDIN_PATH=# path to redirected stdin file (optional) | ||
| STDOUT_PATH=# path to redirected stdout file (optional) | ||
| STDERR_PATH=# path to redirected stderr file (optional) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| use std::io::{BufRead, BufReader}; | ||
|
|
||
| #[macro_export] | ||
| macro_rules! mem_size { | ||
| ($value:expr, B) => { | ||
| $value | ||
| }; | ||
|
|
||
| ($value:expr, KB) => { | ||
| $value * 1024 | ||
| }; | ||
|
|
||
| ($value:expr, MB) => { | ||
| $value * 1024 * 1024 | ||
| }; | ||
|
|
||
| ($value:expr, GB) => { | ||
| $value * 1024 * 1024 * 1024 | ||
| }; | ||
| } | ||
|
|
||
| pub fn get_from_config(variable: &str) -> Option<String> { | ||
| let conf_file = std::fs::OpenOptions::new() | ||
| .read(true) | ||
| .open("./container.conf") | ||
| .expect("Opening .conf file"); | ||
|
|
||
| let conf_file = BufReader::new(conf_file); | ||
| for line in conf_file.lines() { | ||
| let line = line.expect("Reading line from .conf"); | ||
|
|
||
| if let Some((key, val)) = line.split_once('=') { | ||
| if key == variable && !val.trim().starts_with('#') { | ||
| return Some(val.trim().to_string()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| None | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Incapsulates' to 'Encapsulates'.