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 time | |
| import requests | |
| import json | |
| import pings # pip install pings | |
| HOSTNAME = '{{ HOSTNAME }}' | |
| PING_TIMES = 10 | |
| SLEEP_TIME = 100 | |
| WEBHOOK_URL = '{{ WEBHOOK_URL }}' |
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
| kubectl get pods --field-selector=status.phase=Failed | cut -d' ' -f 1 | sed -e '1d' | xargs kubectl delete pod |
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 | |
| import matplotlib.pyplot as plt | |
| %load_ext autoreload | |
| %autoreload 2 | |
| # pandas settings | |
| pd.set_option('display.max_columns', 200) | |
| pd.set_option('display.max_rows', 100) |
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
| create temp function ndcg(rels array<int64>, k int64) returns float64 as ( | |
| ( | |
| with gain as ( | |
| select | |
| (pow(2, rel) - 1) / log(i + 2) as g, | |
| (pow(2, rel_sorted) - 1) / log(i + 2) as g_ideal | |
| from | |
| unnest(rels) as rel with offset as i | |
| left join unnest(( | |
| select |
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
| // ref: https://stackoverflow.com/questions/17267329/converting-unicode-character-to-string-format | |
| function unicodeToChar(text) { | |
| return text.replace(/\\u[\dA-F]{4}/gi, | |
| function (match) { | |
| return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16)); | |
| }); | |
| } |
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 sys | |
| from http.server import SimpleHTTPRequestHandler, HTTPServer | |
| class GzipRequestHandler(SimpleHTTPRequestHandler): | |
| '''HTTPRequestHandler for gzip files''' | |
| def end_headers(self): | |
| '''Set Content-Encoding: gzip for gzipped files''' | |
| if self.path.endswith('.gz'): |
OlderNewer