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
#!/usr/bin/python3.10 | |
from pathlib import Path | |
import argparse | |
import SimpleITK as sitk | |
def main(folder: str, output: str | None): | |
input_path = Path(folder) | |
output_path = input_path if output is None else Path(output) | |
output_path.mkdir(parents=True, exist_ok=True) | |
for file in input_path.iterdir(): |
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
#!/usr/bin/env python3 | |
"""Update binaries from github release page. Check if there are new binaries and download the files | |
""" | |
from pathlib import Path | |
from datetime import datetime, timedelta | |
import json | |
import requests | |
import re | |
import subprocess |
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
# Real colorscheme for https://www.reddit.com/r/unixporn/comments/vkcasz/i3gaps_i_prefer_light_mode/ | |
# Purportedly, the dotfile is from here: https://github.com/Swexti/dots | |
# But these are not the same as the screenshot in the post. | |
# The following colorscheme is colorpicked from the screenshot | |
colors: | |
# Default colors | |
primary: | |
background: '#F4F5F8' | |
foreground: '#464658' |
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
#!/bin/sh | |
HOST_NAME=`hostname` | |
HOST_IP=`nslookup $HOST_NAME | awk /Address:\ [-.0-9]/ | awk -F\ '{print $NF}'` | |
if [ $# -eq 0 ] | |
then | |
PORT=54321 | |
else | |
PORT=$1 | |
fi |
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
set-option -g visual-activity off | |
set-option -g visual-bell off | |
set-option -g visual-silence off | |
set-window-option -g monitor-activity off | |
set-option -g bell-action none | |
# The window modes { | |
setw -g mode-style bg="black",fg="red",bold | |
# } |
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 collections import deque | |
import numpy as np | |
def cumulative_return(x: np.ndarray) -> np.ndarray: | |
"""Calculate the cumulative annual return from monthly fluctuations | |
Args: | |
x: an 1D array, each item is a float showing proportion of change of investment in that month | |
Returns: | |
an 1D array, each item is the annual rate of change (return) for the 12 previous months | |
""" |
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 | |
from scipy.linalg import eigh | |
def cpca(cov: np.ndarray, sample_n: np.ndarray, comp_n: int = 0, tol: float = 1E-6, | |
max_iter: int = 1000) -> np.ndarray: | |
""" | |
Args: | |
cov: 3D array where the last 2 axes are covariance matrices. | |
sample_n: for each covariance, how many samples were in there. | |
""" |
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 typing import Optional, List | |
import numpy as np | |
from scipy.stats import gaussian_kde | |
from matplotlib.axes import Axes | |
from matplotlib.transforms import Affine2D | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.axisartist.floating_axes import GridHelperCurveLinear, FloatingSubplot | |
HISTOGRAM_RATIO = 0.2 # length vs. height ratio of the histogram |
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
let hintcharacters = "asdfghjkl;" | |
map d closeTab | |
map u lastClosedTab | |
map <C-o> goBack | |
map <C-i> goForward | |
let searchalias w = "wikipedia" | |
let searchalias s = "scholar" |