Skip to content

Instantly share code, notes, and snippets.

@RichardHladik
Created February 26, 2018 17:34
Show Gist options
  • Select an option

  • Save RichardHladik/654bc7df8be2b61f43175a8c36c307d6 to your computer and use it in GitHub Desktop.

Select an option

Save RichardHladik/654bc7df8be2b61f43175a8c36c307d6 to your computer and use it in GitHub Desktop.
CodeVita 2018 install script
setxkbmap cz
sudo apt-get install vim valgrind tmux
mkdir w
cat << EOD > .vimrc
set autoindent
set smartindent
set number
EOD
cat <<EOD >w/template.cpp
#include <bits/stdc++.h>
#define ll long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (b) - 1; i >= (a); i--)
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
int n;
cin >> n;
}
EOD
cat <<'EOD' >w/sc
alias t="basename \$(realpath .)"
b(){
fl=-O2\ -fsanitize=address
v=
[ a"$1" = a-d ] && fl=-g && v=valgrind
g++ -std=c++11 -lm -Wall -Wno-sign-compare -Wshadow $fl `t`.cpp -o `t`
for i in `t`.in*; do echo $i:; $v ./`t` < $i; done
}
p(){
for i in `t`.in*; do echo $i:; python3 `t`.py < $i; done
}
n(){
mkdir "$1"
cd "$1"
cp -rn ../template.cpp "$1".cpp
}
EOD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment