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 | |
r = np.arange(1.0, 11.0, 0.1) | |
n = len(r)**3 | |
pts = np.empty((n, 3)) | |
i = 0 | |
for x in r: | |
for y in r: | |
for z in r: |
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
using Genie | |
import Genie.Router: route, @params | |
import Base.convert | |
convert(::Type{Int}, s::SubString{String}) = parse(Int, s) | |
route("/sum/:x::Int/:y::Int") do |
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 pandas as pd | |
def mili_to_h(mili): | |
return mili / 60 / 60 / 1000 | |
df = pd.read_csv("SaveMyTime export 12_06_2018 to 13_06_2019.csv") | |
mlh = df[df["activityName"] == "MLH"] | |
gitkraken_start = pd.Timestamp("2019-05-01 00:00") | |
ibm_start = pd.Timestamp("2019-05-20 00:00") |
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
date_col = "datetime" | |
data_col = "data" | |
filename = "whatevs.csv" | |
in_df = pd.read_csv(filename, | |
usecols=[date_col, data_col], | |
infer_datetime_format=True, index_col=data_col, parse_dates=data_col) |
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 matplotlib.pyplot as plt | |
def plot_missing(df: pd.DataFrame, reg_diff, color="red"): | |
d_diff = np.diff(df.index) | |
gaps = d_diff > np.timedelta64(int(reg_diff), 'ns') | |
gap_sizes = d_diff[gaps] | |
for win_start, g_s in zip(df.index[:-1][gaps], gap_sizes): |
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
"""Adapted from https://askubuntu.com/a/597414/168094 | |
Example usage: python3 add_shortcut.py "xkill-short" "xkill" "<Alt><Ctrl><Shift>x" | |
""" | |
import argparse | |
import subprocess | |
parser = argparse.ArgumentParser() | |
parser.add_argument("name", help="Name of keyboard shortcut") |
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
sudo dnf install kernel --enablerepo=updates-testing --best --allowerasing | |
sudo dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo | |
sudo dnf update | |
sudo dnf -y remove "nouveau*" | |
sudo dnf -y install nvidia-driver akmod-nvidia nvidia-driver-cuda |
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 json | |
import requests | |
yelp_auth = "nope" | |
def get_events( city ): | |
headers = { "Authorization": f"Bearer {yelp_auth}" } | |
params = {"location": city, "limit": 5, "term": "seafood"} | |
req = requests.get( |
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 tqdm import tqdm | |
def chunker(seq, size): | |
for pos in range(0, len(seq), size): | |
yield seq[pos:pos + size] | |
with open("input.csv") as csv_fi: | |
csv_lines = csv_fi.readlines() |
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
# requires yq and jq to be installed | |
kubectl get pods $1 -o yaml | yq .metadata.annotations.\"workflows.argoproj.io/template\" | jq -r | jq |