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): def ensure(*packages):
for pkg in packages: for pkg in packages:
try: __import__(pkg) 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') ensure('pandas', 'tabulate')
import subprocess, multiprocessing as mp, warnings, pandas as pd import subprocess, multiprocessing as mp, warnings, pandas as pd
from tqdm.auto import tqdm
from tabulate import tabulate from tabulate import tabulate
warnings.filterwarnings("ignore") warnings.filterwarnings("ignore")
R, G, B, W = (f'\x1b[{x}m' for x in (31, 32, 34, 0)) 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' 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): def speed(core):
output = subprocess.run( output = subprocess.run(

View File

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