View languages.toml
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
[[language]] | |
name = "python" | |
scope = "source.python" | |
injection-regex = "python" | |
file-types = ["py","pyi","py3","pyw",".pythonstartup",".pythonrc"] | |
shebangs = ["python"] | |
roots = [".", "pyproject.toml", "pyrightconfig.json"] | |
comment-token = "#" | |
language-servers = ["pyright", "ruff"] | |
indent = { tab-width = 4, unit = " " } |
View branch.sh
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
branch () { | |
branches=$(git for-each-ref --sort=-committerdate refs/heads/ --format='%(color:cyan)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:magenta)%(authorname)%(color:reset)' --color=always|column -ts'|') && | |
branch=$(echo "$branches" | fzf --multi --ansi --height=20%) | |
if [ -z "${branch}" ]; | |
then return 0 | |
else git switch $(echo "$branch" | sed "s/ .*//") | |
fi | |
} |
View venv.sh
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
venv () { | |
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
# create virtualenv | |
if [ ! -d .venv ] # if venv does not exist already | |
then | |
python -m venv .venv --system-site-packages | |
else | |
echo -e "${RED}.venv${NC} already exists!" | |
return 0 |
View train_test_split_polars.py
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
def train_test_split( | |
df: pl.DataFrame, train_fraction: float = 0.75 | |
) -> Tuple[pl.DataFrame, pl.DataFrame]: | |
"""Split polars dataframe into two sets. | |
Args: | |
df (pl.DataFrame): Dataframe to split | |
train_fraction (float, optional): Fraction that goes to train. Defaults to 0.75. |
View lightgbm_gpu.sh
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
module load CUDA/11.0 CMake/3.21.1-GCCcore-11.2.0 Boost/1.74.0-GCC-10.2.0 | |
pip install lightgbm --install-option=--gpu | |
# If running from notebook, ensure that the following contains Boost: | |
# import os | |
# os.environ["LD_LIBRARY_PATH"].split(":") |
View xgboost_gpu.sh
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
# must not use gcc version > 10 | |
module load CUDA/11.0 CMake/3.21.1-GCCcore-11.2.0 | |
# Clone with recursive! Otherwise you get dmlc error later on! | |
git clone --recursive https://github.com/dmlc/xgboost | |
cd xgboost/python-package | |
# clean out any old build files that may break things if try to recompile | |
rm -rf build |
View docker_terminal.sh
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 a directory with a Dockerfile | |
# Example Dockerfile with "Dockerfile" as filename | |
FROM python:3.10-slim-buster | |
RUN pip install numpy | |
# Then, run the following | |
docker build -t your_image_name . |
View cmap.py
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 matplotlib.colors import LinearSegmentedColormap | |
def black_to_color(high_color: tuple, low_color: tuple = (0,0,0), name: str = "my_color", steps=256): | |
"Get linear colormap from one rgb color to another, defaulting from black" | |
r1,g1,b1 = low_color | |
r2,g2,b2 = high_color | |
cdict = { | |
'red': [(0.0, r1, r1), |
View gist:4c63d9f15a6895a4153e9bfa98f75360
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
cat /root/.jupyter/lab/user-settings/@jupyterlab/notebook-extension/tracker.jupyterlab-settings | |
{ | |
// Notebook | |
// @jupyterlab/notebook-extension:tracker | |
// Notebook settings. | |
// ************************************** | |
// Code Cell Configuration | |
// The configuration for all code cells. | |
"codeCellConfig": { |
View check_docker_running.sh
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
if docker info > /dev/null 2>&1; then | |
: # pass | |
else | |
echo "Docker Daemon is not running. Please open it and retry." | |
exit -1 | |
fi |
NewerOlder