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
" https://vi.stackexchange.com/questions/5110/quickfix-support-for-python-tracebacks | |
if exists("current_compiler") | |
finish | |
endif | |
let current_compiler = "python" | |
let s:cpo_save = &cpo | |
set cpo&vim |
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
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" | |
# vim-like pane switching | |
bind -r k select-pane -U | |
bind -r j select-pane -D | |
bind -r h select-pane -L | |
bind -r l select-pane -R | |
# panes | |
set -g pane-border-style 'fg=colour19 bg=colour0' |
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 nu | |
syntax on | |
set autoindent | |
colorscheme elflord | |
set background=dark | |
set tabstop=4 | |
set shiftwidth=4 | |
set smarttab | |
set expandtab |
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 split_data(full_dataset, split_ratio=0.8): | |
""" | |
Take a single dataset and split into 2 datasets of given length | |
""" | |
train_size = int(split_ratio * len(full_dataset)) | |
test_size = len(full_dataset) - train_size | |
train_dataset, test_dataset = torch.utils.data.random_split(full_dataset, [train_size, test_size]) | |
return train_dataset, test_dataset | |
def save_checkpoint(state, checkpoint, is_best=False): |
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 build_legend(data): | |
""" | |
Build a legend for matplotlib plt from dict of key -> colors. | |
>> plt.legend(handles = build_legend(cmap)) | |
""" | |
legend_elements = [] | |
for key in data: | |
legend_elements.append(plt.Line2D([0], [0], marker='o', color='w', label=key, | |
markerfacecolor=data[key], markersize=10)) |