Merge branch 'master' of https://git.yauk.tv/jay817/wiki
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.ipynb_checkpoints
|
||||
10
README.md
10
README.md
@@ -1 +1,9 @@
|
||||
# wiki
|
||||
# wiki
|
||||
|
||||
```shell
|
||||
mkdir -p ~/.config && cd ~/.config
|
||||
git clone https://git.yauk.tv/jay817/wiki
|
||||
ln -s $(pwd)/wiki/linux-bash/bash_aliases.sh ~/.bash_aliases
|
||||
RC="$HOME/.${SHELL##*/}rc" && echo $RC
|
||||
source "$RC"
|
||||
```
|
||||
|
||||
1
cpu-bench/.gitignore
vendored
Normal file
1
cpu-bench/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.csv
|
||||
41
cpu-bench/bench.py
Executable file
41
cpu-bench/bench.py
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
def ensure(*packages):
|
||||
for pkg in packages:
|
||||
try: __import__(pkg)
|
||||
except: import os; os.sytem(f'pip install -q {pkg}')
|
||||
ensure('pandas', 'tabulate')
|
||||
|
||||
import subprocess, multiprocessing as mp, warnings, pandas as pd
|
||||
from tabulate import tabulate
|
||||
warnings.filterwarnings("ignore")
|
||||
R, G, B, W = (f'\x1b[{x}m' for x in (31, 32, 34, 0))
|
||||
subprocess.run('clear')
|
||||
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}')
|
||||
|
||||
def speed(core):
|
||||
output = subprocess.run(
|
||||
command(core), shell=True, capture_output=True, text=True
|
||||
).stdout.split()[-1]
|
||||
return float(output)
|
||||
|
||||
df = []
|
||||
for core in range(1, mp.cpu_count()+1):
|
||||
s = speed(core)
|
||||
row = {
|
||||
'#Threads': core,
|
||||
'Throughput(/s)': s,
|
||||
'(per-core)': s/core
|
||||
}
|
||||
df.append(row)
|
||||
df = pd.DataFrame(df)
|
||||
df.to_csv('result.csv', index=False)
|
||||
|
||||
df.iloc[:, 0] = df.iloc[:, 0].apply(lambda s: f'{R}{s}{W}')
|
||||
df.iloc[:, 1] = df.iloc[:, 1].apply(lambda s: f'{G}{int(s)}{W}')
|
||||
df.iloc[:, 2] = df.iloc[:, 2].apply(lambda s: f'{B}{int(s)}{W}')
|
||||
print(tabulate(df, headers='keys', tablefmt='rounded_outline', showindex=False))
|
||||
@@ -1,16 +1,24 @@
|
||||
export RC="~/.bash_aliases"
|
||||
alias rc="vi $RC && tail $RC && source $HOME/.${SHELL##*/}rc"
|
||||
alias bat="batcat --paging=never"
|
||||
|
||||
alias l="ls -al --color=auto"
|
||||
alias my="sudo chown -R $(id -u):$(id -g)"
|
||||
|
||||
alias l="ls -l --color=auto"
|
||||
alias ls="ls -al --color=auto"
|
||||
alias ns="watch -n 0.1 nvidia-smi"
|
||||
alias log="docker compose logs -f" # compose V2
|
||||
log() {
|
||||
if [ $# -eq 0 ]; then
|
||||
docker compose logs -f
|
||||
else
|
||||
docker logs -f "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
alias i="sudo apt-get install -y"
|
||||
alias debian="docker run -it --rm --gpus all python bash"
|
||||
alias debian="docker run -it --rm --gpus all python:3.12 bash"
|
||||
alias download="huggingface-cli download"
|
||||
alias journal="sudo journalctl -u"
|
||||
alias bsah="bash" # common typing error
|
||||
alias pyhton="python" # common typing error
|
||||
alias make="make -j"
|
||||
|
||||
export GGML_CUDA=1
|
||||
@@ -25,6 +33,11 @@ alias dpkg="sudo dpkg"
|
||||
alias systemctl="sudo systemctl"
|
||||
alias service="sudo service"
|
||||
|
||||
alias bsah="bash" # common typing error
|
||||
alias pyhton="python" # common typing error
|
||||
alias stauts="status"
|
||||
alias stuats="status"
|
||||
|
||||
dash() { sudo docker run -it --rm "$1" bash; }
|
||||
alias nuc="ssh 192.168.12.2"
|
||||
alias mac="ssh jaewooklee@192.168.12.45"
|
||||
@@ -33,7 +46,11 @@ alias ping="ping -c 2"
|
||||
|
||||
diff() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
git diff --staged
|
||||
clear
|
||||
git status
|
||||
echo
|
||||
echo
|
||||
git diff --staged
|
||||
else
|
||||
diff -qr "$@"
|
||||
fi
|
||||
@@ -64,16 +81,31 @@ alias df="df -h"
|
||||
alias status="git status ."
|
||||
alias push="git push"
|
||||
alias pull="git pull"
|
||||
alias add="git add"
|
||||
|
||||
add() {
|
||||
if [ $# -eq 0 ]; then
|
||||
git add .
|
||||
else
|
||||
git add $@
|
||||
fi
|
||||
diff
|
||||
}
|
||||
alias remote="git remote -v"
|
||||
alias stash="git stash"
|
||||
alias vimrc="vi ~/.vimrc"
|
||||
commit() {
|
||||
git commit -m "$*"
|
||||
git commit -m "$*"
|
||||
}
|
||||
|
||||
git() {
|
||||
if [[ "$1" == "diff" ]]; then
|
||||
shift
|
||||
command git diff --staged "$@"
|
||||
elif [[ "$1" == "remote" ]]; then
|
||||
shift
|
||||
command git remote -v "$@"
|
||||
elif [[ "$1" == "status" ]]; then
|
||||
command git status .
|
||||
command git diff --staged --stat
|
||||
else
|
||||
command git "$@"
|
||||
fi
|
||||
@@ -81,3 +113,5 @@ git() {
|
||||
|
||||
alias cls="clear"
|
||||
alias weather="curl ko.wttr.in"
|
||||
|
||||
alias dryblack="clear; black --check --diff --color ."
|
||||
@@ -18,7 +18,7 @@ set incsearch " 입력하는 동안 실시간 검색
|
||||
set hlsearch " 검색 결과 하이라이트
|
||||
|
||||
" 기타 유용한 설정
|
||||
" set clipboard=unnamedplus " 시스템 클립보드 사용
|
||||
set clipboard=unnamedplus " 시스템 클립보드 사용
|
||||
set autoindent " 자동 들여쓰기
|
||||
set smartindent " 스마트 들여쓰기
|
||||
set wrap " 줄 바꿈
|
||||
@@ -35,3 +35,5 @@ set background=dark " 어두운 배경 설정
|
||||
" 파일 탐색기 설정 (NERDTree 사용 시)
|
||||
" 플러그인 설치 후 사용
|
||||
" nmap <C-n> :NERDTreeToggle<CR> " Ctrl+n으로 NERDTree 열기
|
||||
"
|
||||
set mouse-=a
|
||||
15
playwright/app.py
Normal file
15
playwright/app.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# pip install playwright && playwright install --with-deps
|
||||
|
||||
import asyncio, threading, queue, io, pandas as pd
|
||||
from playwright.async_api import async_playwright
|
||||
|
||||
def GET(url, html = queue.Queue()):
|
||||
async def aGET(P = async_playwright().start()):
|
||||
html.put(await (await (await (await (await P)
|
||||
.chromium.launch()).new_page()).goto(url)).text())
|
||||
threading.Thread(target=lambda: asyncio.run(aGET())).start()
|
||||
return io.StringIO(html.get())
|
||||
|
||||
df = pd.read_html(GET('https://freeproxy.world/?type=socks5'))[0]
|
||||
df = df.loc[df.Type == 'socks5'].reset_index(drop=True)
|
||||
print(f'\x1b[92m{df}\x1b[0m')
|
||||
Reference in New Issue
Block a user