Skip to content

Instantly share code, notes, and snippets.

View wasdee's full-sized avatar
🏠
Working from home

Nutchanon Ninyawee wasdee

🏠
Working from home
View GitHub Profile
@wasdee
wasdee / AsyncTyper.py
Created July 6, 2023 08:26
asynctyper
from functools import wraps
from typing import Callable
import typer
from asyncio import run
class AsyncTyper(typer.Typer):
def async_command(self, _func: Callable = None, *args, **kwargs):
def decorator(async_func):
@wraps(async_func)
@wasdee
wasdee / start.sh
Last active April 27, 2023 06:45
dvc get started
dvc init
dvc remote add -d storage s3://yyy
dvc remote modify storage endpointurl https://xxx.r2.cloudflarestorage.com/
# global
dvc remote modify --global storage endpointurl https://xxx.r2.cloudflarestorage.com/
dvc remote modify --local myremote account_name 'myaccount'
dvc remote modify --local myremote account_key 'mysecret'
@wasdee
wasdee / scr.bat
Last active April 16, 2023 15:17
windows robocopy
@REM normal copy
robocopy "Source Directory" "Destination Directory" /e /w:5 /r:2 /COPY:DATSOU /DCOPY:DAT /MT:24
@REM normal move
robocopy "Source Directory" "Destination Directory" /e /w:5 /r:2 /COPY:DATSOU /DCOPY:DAT /MT:24 /MOVE
@REM nfs copy
robocopy "Source Directory" "Destination Directory" /e /w:5 /r:2 /COPY:DATO /DCOPY:DAT /MT:24 /MOVE
@wasdee
wasdee / keybase.proof
Created February 9, 2023 01:05
keybase.proof
### Keybase proof
I hereby claim:
* I am wasdee on github.
* I am circleoncircles (https://keybase.io/circleoncircles) on keybase.
* I have a public key ASB2UB20JJrBpl-ONIch2glYEuGmKrii__0scS1G-y-5bAo
To claim this, I am signing this object:
@wasdee
wasdee / cmd.sh
Created December 24, 2022 09:14
check if cmd exist bash
# check if use firewalld
if [ -x "$(command -v firewall-cmd)" ]; then
firewall-cmd --permanent --add-masquerade
fi
#!/usr/bin/env bash
now=$(date +"%Y_%m_%d-%H_%M_%S")
top -b -n 120 > "top-120iters-$now.txt"
# this takes 120 iterations of top, which is 120*3 seconds = 6 minutes
@wasdee
wasdee / cmd.sh
Last active December 22, 2022 06:07
conda export env
# https://docs.conda.io/projects/conda/en/latest/_downloads/843d9e0198f2a193a3484886fa28163c/conda-cheatsheet.pdf
conda env export --from-history > environment.yml
# to restore, must use with env cmd group https://github.com/conda/conda/issues/6827#issuecomment-365614464
conda env create --file environment.yml
conda create -n env_name --file environment.yml #ERROR
@wasdee
wasdee / bash_datetime
Created December 17, 2022 08:05
add datetime bash and create top log
#!/usr/bin/env bash
now=$(date +"%Y_%m_%d-%H_%M_%S")
top -b -n 120 > "top-120iters-$now.txt"
# this takes 120 iterations of top, which is 120*3 seconds = 6 minutes
@wasdee
wasdee / install_protoc.sh
Last active November 30, 2022 14:30
install_protoc.sh
#!/usr/bin/env bash
# https://github.com/protocolbuffers/protobuf/releases
PROTOC_VERSION=21.9
PLATFORM=linux-x86_64
wget --output-document protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-linux-x86_64.zip
unzip protoc.zip -d protoc
sudo mv protoc/bin/protoc /usr/local/bin/
sudo mv protoc/include/google /usr/local/include/
@wasdee
wasdee / princessandatom.omp.json
Last active July 29, 2022 07:04
priceandatom.omp.json
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"type": "text",
"style": "diamond",
"leading_diamond": "\ue0b6",