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
from fastapi import FastAPI | |
from pydantic import BaseModel | |
app = FastAPI() | |
class A(BaseModel): | |
hoge: str |
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 argparse | |
import datetime | |
import os | |
import re | |
import textwrap | |
def icalentry(cols): | |
day = re.sub(r'\(.+\)', '', cols[3]) | |
ko = "{}/{} {}".format(cols[0], day, cols[4] or '00:00') |
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 optuna | |
# https://optuna.org/ | |
def objective(trial): | |
x = trial.suggest_uniform('x', -10, 10) | |
return (x - 2) ** 2 | |
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 argparse | |
import glob | |
import os | |
import time | |
import numpy as np | |
from torch.utils.data import DataLoader | |
from pfio.cache import MultiprocessFileCache | |
from pfio.cache import FileCache | |
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
#!/bin/sh | |
# Launch zeal, and bring it to top screen | |
# If it is already on top, bring it to the back (toggle) | |
DEBUG=0 | |
if [ ! -e /usr/bin/zeal ]; then | |
if [ $DEBUG ]; then | |
echo "Zeal not found in /usr/bin/zeal" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 matplotlib.pyplot as plt | |
import numpy as np | |
from sklearn import manifold | |
cities = "Athens Barcelona Brussels Calais Cherbourg Cologne Copenhagen Geneva Gibraltar Hamburg HookOfHolland Lisbon Lyons Madrid Marseilles Milan Munich Paris Rome Stockholm Vienna".split(" ") | |
d = np.array([ | |
# from eurodist dataset: https://rstudio-pubs-static.s3.amazonaws.com/221886_5c57ad0f5ff546e8af6386162f29fabc.html | |
[ 0, 3313, 2963, 3175, 3339, 2762, 3276, 2610, 4485, 2977, 3030, 4532, 2753, 3949, 2865, 2282, 2179, 3000, 817, 3927, 1991], | |
[3313, 0, 1318, 1326, 1294, 1498, 2218, 803, 1172, 2018, 1490, 1305, 645, 636, 521, 1014, 1365, 1033, 1460, 2868, 1802], | |
[2963, 1318, 0, 204, 583, 206, 966, 677, 2256, 597, 172, 2084, 690, 1558, 1011, 925, 747, 285, 1511, 1616, 1175], |
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 chainer | |
import chainer.links as L | |
import numpy as np | |
import chainer_computational_cost as c3 | |
net = L.VGG16Layers() | |
x = np.random.random((1, 3, 224, 224)).astype(np.float32) # dummy input | |
with chainer.no_backprop_mode(), chainer.using_config('train', False): | |
with c3.ComputationalCostHook(fma_1flop=True) as cch: | |
y = net(x) |
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
if [ ! -z $TMUX ]; then | |
tmux show-options | grep "TMUX_NO_FORCE_NAME_SESSION" > /dev/null | |
if [ $? -ne 0 ]; then | |
SESSION_NAME=`tmux display-message -p '#S'` | |
echo $SESSION_NAME | grep "^[0-9]\+$" > /dev/null | |
if [ $? -eq 0 ]; then # Not named | |
/bin/echo -n "tmux session name: " | |
read NAME | |
if [ ! -z $NAME ]; then | |
tmux rename-session $NAME |
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
#include <iostream> | |
#include <experimental/optional> | |
int main() | |
{ | |
std::experimental::optional<int> t; | |
//t = 100; // comment in/out | |
unsigned char *p = new unsigned char[sizeof(t)]; |
NewerOlder