Terminal Productivity

ssh without password

$ ssh-copy-id -i ~/.ssh/id_rsa.pub -p 300XX xxx-user@10.12.XX.XX

rsync

두 디렉토리 동기화

$ rsync -avzh \
	--dry-run \
	--progress \
	~/Documents/BACKUPZ/2020/ ./2020/

앞에가 src, 뒤가 dest 이며, dry-run 실행 구문이다. --progress412 files to consider 표시.

What’s the version of my OS?

Linux1

Open a terminal and type uname -a. This will give you your kernel version, but might not mention the distribution your running. To find out what distribution of linux your running (Ex. Ubuntu) try lsb_release -a or cat /etc/*release or cat /etc/issue* or cat /proc/version.

dig +trace

$ dig +trace likejazz.com

+trace는 DNS 질의 과정을 root dns 부터 모두 표시해준다.

diff와 patch

다음과 같이 변경 사항을 생성한다.

$ diff -u a-original/a.py a-patched/a.py
--- a-original/a.py	2022-05-11 10:07:21.000000000 +0900
+++ a-patched/a.py	2022-05-11 10:07:42.000000000 +0900
@@ -1,4 +1,4 @@
 aaa
 bbb
-ccc
+ddd
 ddd

> a.patch를 이용해 패치 파일로 저장한 다음, 다음과 같이 적용할 수 있다.

$ patch -p0 < a.patch

a-original/a.py에 패치가 적용된다.

Port Forwarding

$ ssh -N -L 7860:10.17.120.XX:7860 airlab-xxx@10.12.54.XX -p 30001

localhost:7860으로 접속하면 10.12.54.XX:30001의 ssh를 통해 10.17.120.XX:7860으로 연결된다.

ssh 접속 via proxy

$ cat ~/.ssh/config
Host sshuser-vpn
  Hostname 10.17.119.XX
  Port 2222
  User sshuser
  IdentityFile /Users/HXXXXXXX/.ssh/id_rsa_rapids_docker
  ProxyCommand ssh -W 10.17.119.XX:2222 airlab-xxx@10.12.54.XX -p 30001

$ ssh sshuser-vpn

10.12.54.XX를 통해서 10.17.119.XX:2222로 ssh 접속한다.

nload

네트워크 모니터링 $ sudo apt install nload

Device는 eth를 택하도록 화살표로 선택하고 F2 옵션에서 Unit for traffic numbers: Human Readable (Byte)에서 TAB으로 선택, F5로 저장

Typora parser

https://github.com/PegasisForever/typora-parser

footnotes가 포함된 행에 superscript가 함께 있을 경우 제대로 처리되지 않는 문제가 있다. src/inlines/inlineNode.ts에서 아래 부분 패치:

const nodePrecedenceGroups = [
  [RawHTMLNode, AutolinkNode, CodeSpanNode, EmojiNode],
  [HighlightNode, SubScriptNode, SuperScriptNode, FootnoteNode],
  [LinkNode.LinkNode],
  [EmphNode.EmphNode],
]

footnotes 순서를 superscript에 포함하여 패치. 빌드 과정:

$ npm i && \
chmod +x ./build/bin/typoraExport.js && \
./build/bin/typoraExport.js -g ./tags.txt -o ./ch5.html "5. test.md" && \
open ./ch5.html

bundle exec jekyll serve

macOS를 업데이트 할 때 마다 실행에 문제가 있다.

macOS 기본 ruby에 system libraries를 설치할 수 없기 때문인데 Ventura에서 다음과 같이 해결했다.

# rvm 설치
$ curl -sSL https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable
$ rvm install "ruby-3.1.2"
$ brew install openssl@1.1

# https://stackoverflow.com/a/31516586
$ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl@1.1)/include

# https://stackoverflow.com/a/70916831
$ bundle add webrick

# runme.sh
$ bundle exec jekyll serve

tar with excludes

디렉토리 제외 설정은 tar 옵션 맨 앞에, cvf는 반드시 하이픈 부여 필요.

$ tar --exclude='*.json' --exclude='FastChat/wandb' --exclude='FastChat/output' -cvf FastChat.tar FastChat/

setup KST timezone

$ sudo apt install tzdata
(6 - 69)

It will automatically set /etc/localtime.

asciinema

터미널 캡처 gif를 가장 깔끔하게 만드는 방법

  • $ brew instal asciinema 설치
    • 굳이 업로드 할 필요는 없다. $ asciinema rec로 record 후 로컬 저장
  • asciinema-edit로 quantize(딜레이 조정), cut(잘라내기)
  • gifcast를 이용해 animated gif로 변환. agg와 달리 한글 문제도 없으며 가장 깔끔하게 변환된다.

또 다른 옵션으로 termtosvg도 있다. 바로 svg로 저장되므로 편리하지만 한글 출력시 약간씩 좌우로 흔들리는 버그가 있다.

Last Modified: 2023/10/29 04:07:40

is a collection of Papers I have written.
© 2000 - Sang-Kil Park Except where otherwise noted, content on this site is licensed under a CC BY 4.0.
This site design was brought from Distill.