From a9647fbb7cdb745c2b148b0fb44612ce1dc7eae2 Mon Sep 17 00:00:00 2001 From: Jaewook Lee <11328376+jaewooklee93@users.noreply.github.com> Date: Sat, 17 Aug 2024 05:10:52 +0900 Subject: [PATCH 1/3] bashrc: change clear to c --- linux-bash/bash_aliases.sh | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/linux-bash/bash_aliases.sh b/linux-bash/bash_aliases.sh index 4c86156..1df4bcf 100644 --- a/linux-bash/bash_aliases.sh +++ b/linux-bash/bash_aliases.sh @@ -1,11 +1,13 @@ 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="ls -alh --color=auto" alias ns="watch -n 0.1 nvidia-smi" log() { if [ $# -eq 0 ]; then @@ -16,7 +18,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 +30,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 +68,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 } @@ -108,7 +118,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" From afc58aac1ff8149fb52d32becedb5cd031e0500d Mon Sep 17 00:00:00 2001 From: Jaewook Lee <11328376+jaewooklee93@users.noreply.github.com> Date: Fri, 16 Aug 2024 16:13:04 -0400 Subject: [PATCH 2/3] bashrc: resolve merge conflict --- linux-bash/bash_aliases.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-bash/bash_aliases.sh b/linux-bash/bash_aliases.sh index 1df4bcf..7e93709 100644 --- a/linux-bash/bash_aliases.sh +++ b/linux-bash/bash_aliases.sh @@ -7,7 +7,8 @@ alias bat="batcat --paging=never" alias my="sudo chown -R $(id -u):$(id -g)" alias l="command ls -lh --color=auto" -alias ls="ls -alh --color=auto" +alias ls="command ls -alh --color=auto" + alias ns="watch -n 0.1 nvidia-smi" log() { if [ $# -eq 0 ]; then @@ -91,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 . From 0ed37081d0952ac8654f2f728ae22f1152fc2688 Mon Sep 17 00:00:00 2001 From: Jaewook Lee <11328376+jaewooklee93@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:32:24 +0900 Subject: [PATCH 3/3] -m change --- cpu-bench/bench.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpu-bench/bench.py b/cpu-bench/bench.py index d1d9613..8ffa1fd 100755 --- a/cpu-bench/bench.py +++ b/cpu-bench/bench.py @@ -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(