This commit is contained in:
Jaewook Lee
2024-08-18 13:54:22 +09:00
2 changed files with 31 additions and 15 deletions

View File

@@ -3,10 +3,11 @@
def ensure(*packages):
for pkg in packages:
try: __import__(pkg)
except: import os; os.sytem(f'pip install -q {pkg}')
except: import os; os.system(f'pip install -q {pkg}')
ensure('pandas', 'tabulate')
import subprocess, multiprocessing as mp, warnings, pandas as pd
from tqdm.auto import tqdm
from tabulate import tabulate
warnings.filterwarnings("ignore")
R, G, B, W = (f'\x1b[{x}m' for x in (31, 32, 34, 0))
@@ -15,7 +16,8 @@ subprocess.run('neofetch')
command = lambda core: f'sysbench cpu --cpu-max-prime=20000 --time=1 --threads={core} run | grep second'
print(f'{G}$ {command("$(nproc)")}{W}')
print(f'{G}$ {command("$(nproc)")}{W}', flush=True)
def speed(core):
output = subprocess.run(

View File

@@ -1,11 +1,14 @@
export RC="~/.bash_aliases"
export PATH=/usr/bin:$PATH
alias rc="vi $RC && tail $RC && source $HOME/.${SHELL##*/}rc"
alias bat="batcat --paging=never"
alias my="sudo chown -R $(id -u):$(id -g)"
alias l="ls -l --color=auto"
alias ls="ls -al --color=auto"
alias l="command ls -lh --color=auto"
alias ls="command ls -alh --color=auto"
alias ns="watch -n 0.1 nvidia-smi"
log() {
if [ $# -eq 0 ]; then
@@ -16,7 +19,7 @@ log() {
}
alias i="sudo apt-get install -y"
alias debian="docker run -it --rm --gpus all python:3.12 bash"
alias debian="docker run -it --rm --gpus all python:3.12-slim bash"
alias download="huggingface-cli download"
alias journal="sudo journalctl -u"
alias make="make -j"
@@ -28,17 +31,23 @@ export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/lib:$LD_LIBRARY_PATH"
export PATH="/home/w/.venv/bin:/home/w/hub/llama.cpp:/usr/local/cuda/bin:$PATH"
alias rsync="rsync -avPh"
alias wg="sudo wg"
alias apt="sudo apt-get"
alias dpkg="sudo dpkg"
alias systemctl="sudo systemctl"
alias service="sudo service"
alias apt="sudo apt-get"
alias bsah="bash" # common typing error
alias pyhton="python" # common typing error
alias stauts="status"
alias stuats="status"
alias chwon="sudo chown"
alias bsah="bash"
alias pyhton="python"
dash() { sudo docker run -it --rm "$1" bash; }
# alias stauts="status"
# alias stuats="status"
dash() {
sudo docker run -it --rm --gpus all --entrypoint=bash "$1";
}
dsh() { sudo docker run -it --rm "$1" sh; }
alias nuc="ssh 192.168.12.2"
alias mac="ssh jaewooklee@192.168.12.45"
alias ip="ip -4"
@@ -60,11 +69,13 @@ alias less="less -SEX"
docker() {
if [[ "$1" == "ps" ]]; then
command sudo docker ps | less -SEX
command docker ps | less -SEX
elif [[ "$1" == "images" ]]; then
command docker images | less -SEX
elif [[ "$1" == "rm" ]]; then
command sudo docker "$@" -f
command docker "$@" -f
else
command sudo docker "$@"
command docker "$@"
fi
}
@@ -81,6 +92,7 @@ alias df="df -h"
alias status="git status ."
alias push="git push"
alias pull="git pull"
alias fetch="git fetch"
add() {
if [ $# -eq 0 ]; then
git add .
@@ -108,7 +120,9 @@ git() {
fi
}
alias cls="clear"
alias c="clear"
alias weather="curl ko.wttr.in"
alias dryblack="clear; black --check --diff --color ."
alias compose="docker compose"
alias compsoe="compose"