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 datetime import datetime | |
from pytz import timezone | |
import subprocess | |
import glob | |
import xml.etree.ElementTree as ET | |
# replaced time zones | |
SRC_TZ_ZONES = ['UTC+09:00', 'UTC+01:00'] | |
# target time zone | |
TGT_TZ_ZONE = ['Europe/Berlin'] |
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
class MetaGlobalVariables(type): | |
@property | |
def HOGE(cls): | |
return cls._GlobalVariables__hoge # mangling | |
class GlobalVariables(object, metaclass=MetaGlobalVariables): | |
__hoge = 'xxxx' | |
# read OK |
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
# Use Graham's example. | |
# http://www.phontron.com/slides/nlp-programming-ja-03-ws.pdf | |
INF = 1e6 | |
edge_list = [ | |
None, # e0 | |
{ # e1 | |
'id': 1, | |
'score': 2.5, | |
'begin_node_id': 0, |
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
defaults write com.adobe.illustrator AppleLanguages '("ja")' |
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 numpy as np | |
import torch | |
from torch import nn | |
class Model(nn.Module): | |
def __init__(self, vocab_size, embd_size, pre_embd_w=None): | |
super(Model, self).__init__() | |
self.embd = nn.Embedding(vocab_size, embd_size, padding_idx=0) |
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 subprocess | |
rev = subprocess.check_output(['git', 'describe', '--always']).strip().decode('utf-8') |
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
liens = [line.rstrip('\n') for line in open('file')] |
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 numpy as np | |
data = np.array([[40, 35, 80], | |
[80, 50, 90], | |
[20, 55, 40], | |
[94, 80, 88], | |
[90, 30, 100]]) | |
print('Input data (N, featuers):', data, data.shape) | |
N = data.shape[0] | |
n_dim = data.shape[1] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.