This file contains 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
set visualbell | |
set noerrorbells | |
set surround | |
set hlsearch | |
nnoremap <silent> <Esc><Esc> <Esc>:nohlsearch<CR><Esc> | |
map <leader>r :register<ENTER> | |
map <C-j> <C-W>j | |
map <C-k> <C-W>k | |
map <C-h> <C-W>h | |
map <C-l> <C-W>l |
This file contains 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
" Auto install from https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
call plug#begin('~/.vim/plugged') | |
Plug 'majutsushi/tagbar', { 'do': 'cp -R ./plugin ~/.vim/' } | |
Plug 'nathanaelkane/vim-indent-guides' |
This file contains 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
def f(x): | |
return x * np.sin(x) | |
xs = np.linspace(-1, 11, 2000) | |
ys = f(xs) | |
def train_dict_and_plot(num_train, quantize_scale): | |
train_x = xs[::len(xs)//num_train] | |
train_y = ys[::len(xs)//num_train] | |
db = {} | |
def quantize(x): | |
return int(x * quantize_scale) |
This file contains 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
import joblib, os, torch | |
from functools import cached_property | |
from google.cloud import storage | |
from google.oauth2 import service_account | |
import torchvision.transforms as transforms | |
def prep_dir(path: str) -> str: | |
if not os.path.exists(path): | |
os.mkdir(path) |
This file contains 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
import csv | |
import os.path | |
def save_scores(scores): | |
with open('scores.csv', 'w+') as f: | |
for score in scores: | |
f.write(str(score) +"\n") | |
def load_scores_from_file(): |