Skip to content

Instantly share code, notes, and snippets.

View yatakeke's full-sized avatar

Yatakeke a.k.a Agile Zamurai yatakeke

View GitHub Profile
import cofigparser
configparser.ConfigParser()
# general type
configparaser.RawConfigParser()
# the type to interporate % or (
from typing import NamedTuple
class PathContainer(NamedTuple):
root: str
document: str
exe: str
path_container = PathContainer("root_path","document_path","exe_path")
# immutableだけど各要素に名前でアクセスできるのが良い点
with open('a', 'r') as a, open('b', 'w') as b:
do_something()
df.isin([1,2])
# 全ての要素が1, 2 をかどうかチェックしてくれる
import pandas as pd
# change the display
pd.set_option('display.max_columns', 100)
pd.set_option('display.max_rows', 100)
@yatakeke
yatakeke / git.md
Last active February 19, 2020 11:23
gitの忘れやすいコマンド類を使った度に更新していく予定

git rm --cached 'file name' ファイルを管理対象から外す(-rでディレクトリごと)

git stash 一時的に変更を保存する

git stash apply stash@{num} 一時的に保存した変更を元に戻す

git checkout

import torch
# save parameters
torch.save(model.state_dict(), PATH)
# load parameters
model = ModelClass(*args, **kwargs)
model.load_state_dict(torch.load(PATH))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.