Skip to content

Instantly share code, notes, and snippets.

View akihironitta's full-sized avatar

Akihiro Nitta akihironitta

View GitHub Profile
#!/usr/bin/env bash
git checkout -b create-pr-from-script master
find .github/workflows -type f | xargs sed -i -- 's/string_before/string_after/g'
git commit -am "COMMIT MESSAGE"
gh pr create --title "PR TITLE" --assignee "@me" --body "PR BODY MESSAGE"
git checkout master
import dis
def func1():
return {"x": 0, "y": 1}
def func2():
return dict(x=0, y=1)
dis.dis(func1)
dis.dis(func2)
@akihironitta
akihironitta / draw_aimd.py
Last active September 2, 2020 08:42
This script draws how Additive Decrease Multiplicative Increase (AIMD) algorithm work in order to understand the algorithm visually.
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
def main():
capacity = 100
throughput = np.array([50., 2.])
decrease = np.array([2., 2.])
increase = np.array([3., 3.])
@akihironitta
akihironitta / search_raise_in_except.py
Last active September 2, 2020 06:46
This Python script prints line numbers of raise in except clause in Python language.
# usage:
#
# To find raises, simply run:
# $ python search_raise_in_except.py target.py
#
# In case you want to find raises in multiple files in current directory, run:
# $ for i in $(find . -type f -name "*.py"); do; python search_raise_in_except.py $i; done`
import _ast
import ast