I hereby claim:
- I am sakurai-youhei on github.
- I am youheisakurai (https://keybase.io/youheisakurai) on keybase.
- I have a public key whose fingerprint is 1FE2 AFDC 87AB FB9E EA88 C634 D985 9D02 813D F63D
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
alias kcfork='install -m 600 $HOME/.kube/config $HOME/.kube/config-PID$$; export KUBECONFIG=$HOME/.kube/config-PID$$' | |
alias kcback='rm -f $HOME/.kube/config-PID$$; unset KUBECONFIG' | |
# You can start an isolated session on a temporal config by `kcfork`, do whatever you want like switching contexts, and end the session by `kcback`. |
ndict = type("ndict", (dict, ), {"__getitem__": lambda *args: dict.setdefault(*args, ndict())}) | |
intro = ndict() | |
intro['here']['is']['my name'] = 'Youhei Sakurai' | |
intro['here']['is']['my favorite'] = 'Python' | |
print(intro) # Outputs: {'here': {'is': {'my name': 'Youhei Sakurai', 'my favorite': 'Python'}}} |
from collections import OrderedDict | |
from http.client import HTTPMessage | |
class MultiValueHeaders(HTTPMessage): | |
'''https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2''' | |
_separator_ = ', ' | |
def items(self): | |
headers = OrderedDict() | |
for key, value in super().items(): |
series = daysoff.astype(int).to_series() | |
delta_2days = pd.Timedelta(2, unit='d').to_timedelta64().astype(float) | |
consecutive_3days = lambda S: abs(S.iloc[0] - S.iloc[-1]) == delta_2days | |
start = series.iloc[::-1].rolling(3).apply(consecutive_3days)[::-1].fillna(0) | |
middle = series.rolling(3, center=True).apply(consecutive_3days).fillna(0) | |
end = series.rolling(3).apply(consecutive_3days).fillna(0) | |
consecutive_3plus_daysoff = daysoff[(start + middle + end).astype(bool)] # 期間中の3連休以上 |
weekends = alldays.difference(weekdays) # 期間中の土日 | |
daysoff = (weekends | holidays) # 期間中の休日 |
import shukujitsu | |
holidays = alldays & pd.DatetimeIndex(shukujitsu.Japan()) # 期間中の祝日 | |
bizdays = weekdays.difference(holidays) # 期間中の平日 |
import pandas as pd | |
period = ("2020-01-01", "2020-12-31") | |
alldays = pd.date_range(*period, freq="D") # 期間中の毎日 | |
weekdays = pd.date_range(*period, freq="B") # 期間中の月~金 |
from datetime import date | |
from difflib import unified_diff | |
import jpholiday | |
import shukujitsu | |
a = [] | |
for day in shukujitsu.Japan()["1990-1-1": "2024-12-31"]: | |
a.append("{}\n".format(day)) |
# empty |