This file contains hidden or 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
| @echo off | |
| kubectl %* | |
| exit /b %ERRORLEVEL% |
This file contains hidden or 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
| document.addEventListener('deviceready', brython, false); |
This file contains hidden or 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
| # empty |
This file contains hidden or 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 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)) |
This file contains hidden or 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 pandas as pd | |
| period = ("2020-01-01", "2020-12-31") | |
| alldays = pd.date_range(*period, freq="D") # 期間中の毎日 | |
| weekdays = pd.date_range(*period, freq="B") # 期間中の月~金 |
This file contains hidden or 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 shukujitsu | |
| holidays = alldays & pd.DatetimeIndex(shukujitsu.Japan()) # 期間中の祝日 | |
| bizdays = weekdays.difference(holidays) # 期間中の平日 |
This file contains hidden or 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
| weekends = alldays.difference(weekdays) # 期間中の土日 | |
| daysoff = (weekends | holidays) # 期間中の休日 |
This file contains hidden or 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
| 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連休以上 |
This file contains hidden or 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 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(): |
This file contains hidden or 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
| 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'}}} |