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
{"Key Mappings":{"0xf700-0x260000":{"Text":"[1;6A","Action":10},"0x37-0x40000":{"Text":"0x1f","Action":11},"0x32-0x40000":{"Text":"0x00","Action":11},"0xf709-0x20000":{"Text":"[17;2~","Action":10},"0xf70c-0x20000":{"Text":"[20;2~","Action":10},"0xf729-0x20000":{"Text":"[1;2H","Action":10},"0xf72b-0x40000":{"Text":"[1;5F","Action":10},"0xf705-0x20000":{"Text":"[1;2Q","Action":10},"0xf703-0x260000":{"Text":"[1;6C","Action":10},"0xf700-0x220000":{"Text":"[1;2A","Action":10},"0xf701-0x280000":{"Text":"0x1b 0x1b 0x5b 0x42","Action":11},"0x38-0x40000":{"Text":"0x7f","Action":11},"0x33-0x40000":{"Text":"0x1b","Action":11},"0xf703-0x220000":{"Text":"[1;2C","Action":10},"0x7f-0x80000-0x33":{"Version":1,"Action":11,"Text":"0x17","Label":""},"0xf701-0x240000":{"Text":"[1;5B","Action":10},"0xf70d-0x20000":{"Text":"[21;2~","Action":10},"0xf702-0x260000":{"Text":"[1;6D","Action":10},"0xf729-0x40000":{"Text":"[1;5H","Action":10},"0xf706-0x20000":{"Text":"[1;2R","Action":10},"0x34-0x40000":{"Text":"0x1c","Action":11},"0xf700 |
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 os | |
import json | |
import time | |
import logging | |
import argparse | |
import yaml | |
from pprint import pprint | |
from tencentcloud.common import credential | |
from tencentcloud.common.profile.client_profile import ClientProfile | |
from tencentcloud.common.profile.http_profile import HttpProfile |
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/bash | |
set -euxo pipefail | |
IMAGE='' | |
NAME='' | |
docker run -dt \ | |
--shm-size=32gb \ | |
--gpus=all \ |
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 on_starting(server): | |
setattr(server, '_worker_id_set', set()) | |
def _next_worker_id(server): | |
if hasattr(server, '_worker_id_set') and isinstance(server._worker_id_set, set) and len(server._worker_id_set) > 0: | |
return server._worker_id_set.pop() | |
in_use = set(w._worker_id for w in tuple(server.WORKERS.values()) if hasattr(w, '_worker_id') and w.alive) | |
free = set(range(1, server.num_workers + 1)) - in_use |
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/bash | |
IMAGE_ID="65c89db00d47" | |
DIR="tmp" | |
RAW=$(docker inspect "${IMAGE_ID}" | jq '.[].GraphDriver.Data.LowerDir' -r) | |
IFS=':' read -r -a DATA <<< "${RAW}" | |
for s in ${DATA[@]}; 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
def check_if_cuda_available() -> bool: | |
try: | |
import torch | |
return torch.cuda.is_available() | |
except Exception: | |
try: | |
import subprocess | |
subprocess.run(['nvidia-smi']) | |
return True | |
except Exception: |
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 | |
import os | |
import glob | |
import argparse | |
import typing | |
from concurrent.futures import ThreadPoolExecutor | |
parser = argparse.ArgumentParser() | |
parser.add_argument('files', nargs='+', type=str) | |
parser.add_argument('-d', '--dry-run', dest='dry_run', action='store_true') |
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
// exec bash in docker container | |
function enterc() { | |
docker exec -it $1 /bin/bash | |
}export enterc | |
function docker_get_tags() { | |
curl "https://registry.hub.docker.com/v1/repositories/$1/tags" | jq '.[].name' | |
} | |
export docker_get_tags |
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/local/opt/python@3.10/bin/python3 | |
import sys | |
import os | |
from PIL import Image | |
import argparse | |
def webp2png(src_name, dst_name): | |
im = Image.open(src_name).convert('RGB') | |
im.save(dst_name, 'png') |
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 laststatus=2 | |
set number | |
set hlsearch | |
set incsearch | |
set autoindent | |
set smartindent | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set softtabstop=4 |
NewerOlder