-
Squash commits into a single commit and rebase feature branch onto
upstream/develop
git fetch upstream && git rebase -i $(git merge-base feature_name upstream/develop)
-
Cleanup git repository aggressively
use bfg https://rtyley.github.io/bfg-repo-cleaner/
java -jar bfg.jar --delete-files your_unwanted_files
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
{ | |
// For a full list of commands, refer | |
// https://github.com/jupyterlab/jupyterlab/blob/master/packages/notebook-extension/src/index.ts | |
"shortcuts":[ | |
{ | |
"command":"notebook:run-all-above", | |
"keys":[ | |
"F5" | |
], | |
"selector":".jp-Notebook:focus" |
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
# pip install autopep8 pylint flake8 black blackcellmagic yapf | |
Program: autopep8 | |
Arguments: --in-place --aggressive --aggressive $FilePath$ | |
Working Directory: $ProjectFileDir$ | |
Regular expression to match output:$FILE_PATH$:$LINE$:$COLUMN$:.* | |
Program: pylint | |
Arguments: "--msg-template='{abspath}:{line}: [{msg_id}({symbol}), {obj}] {msg}'" --output-format=colorized "$FilePath$" | |
Working directory: $ProjectFileDir$ |
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 yum --enablerepo=extras install centos-release-scl; | |
sudo yum install devtoolset-7; | |
scl enable devtoolset-7 bash |
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
# Add to ~/.bash_aliases | |
alias port_forward='nohup ssh -N -f -L localhost:8889:localhost:8889 username:password@remote_server_ip' | |
alias remote_notebook_start='nohup ssh -f username:password@remote_server_ip "cd rne; conda activate env_name; jupyter notebook --no-browser --port=8889"; port_forward' | |
alias remote_notebook_stop='ssh username:password@remote_server_ip "pkill -u username jupyter"' | |
# Add this to crontab -e | |
@reboot cd /home/{username}; source ./.bashrc; ./miniconda3/envs/{env_name}/bin/jupyter-lab >> ./cronrun.log 2>&1 |
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 functools | |
from typing import Any, Mapping | |
def singleton(cls): | |
'''a class decorator that wraps class definition so that only one class instance can exist''' | |
existing_instances = dict() | |
@functools.wraps(cls) | |
def singleton_class(*args, **kwargs): | |
if cls not in existing_instances: |
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
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# SPDX-License-Identifier: LicenseRef-.amazon.com.-AmznSL-1.0 | |
# Licensed under the Amazon Software License http://aws.amazon.com/asl/ | |
"""S3 Client | |
A helper class which wraps boto3's s3 service | |
""" | |
__author__ = "Liutong Zhou" |
- Launch: t3.2xlarge ($0.33/h) / m8g.4xlarge ($0.718) / g6.4xlarge ($1.32/h) / p3.2xlarge ($3.02/h)
- Image: Deep Learning AMI (Ubuntu 22.04)
- Configure Security Group:
- open custom TCP and port 9999
- open HTTPS, HTTP to anywhere
- Attach an Elastic IP to the instance
ssh into EC2 from MobaXterm and run
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
""" Time-and-Space-Efficient Sampling Methods""" | |
from typing import Iterable | |
from random import random, randint, seed | |
from math import exp, log, floor | |
from itertools import islice | |
__author__ = "Liutong Zhou" | |
def take(iterable, n: int) -> list: |
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
"""UnionFind (Disjoint Sets)""" | |
from typing import Optional, Iterable, Hashable, Any | |
class UnionFind: | |
def __init__( | |
self, initial_disjoint_items: Optional[Iterable[Hashable]] = None | |
): | |
"""Initialize a UnionFind of disjoint sets""" |
OlderNewer