$ git config --global url.git@github.com:.insteadOf https://dasomoli@github.com/
$ go get github.com/dasomoli/private-repo
참고: https://stackoverflow.com/questions/27500861/whats-the-proper-way-to-go-get-a-private-repository
$ git config --global url.git@github.com:.insteadOf https://dasomoli@github.com/
$ go get github.com/dasomoli/private-repo
참고: https://stackoverflow.com/questions/27500861/whats-the-proper-way-to-go-get-a-private-repository
‘&'(anchor) 와 ‘*’ 의 의미는 https://stackoverflow.com/questions/46641224/what-is-and-in-yaml-mean 를 참고.
여기 잘 정리되어 있다.
https://learnxinyminutes.com/docs/yaml/
이에 대응하는 한글 문서는 https://learnxinyminutes.com/docs/ko-kr/yaml-kr/ 이다.
Pull request가 필요할 거 같다….
트랜잭션 T는 다음 data를 포함한다.
T = { nonce, gasPrice, gasLimit, to, value, data, v, r, s }
function selector와 그 이후의 function argument를 serialize한 data이다.function selector = (keccak-256(function prototype))[0:4]서명 시 사용되는 트랜잭션 T는 9개 필드로 다음과 같다. 이 중 맨 끝의 3개 { chainID, 0, 0 }은 EIP-155에 의해 추가된다. EIP-155는 Simple Replay Attack Protection으로 chainID를 포함하여 다른 네트워크 체인에서 해당 트랜잭션이 replay될 수 없도록 한다.
T = { nonce, gasPrice, gasLimit, to, value, data, chainID, 0, 0 }
Sig는 서명으로 서명 알고리즘, F sig() 로 (r, s) 두 값이 output으로 만들어진다. Transaction T와 private key k를 사용한다. RLP는 Recursive Length Prefix (RLP) encoding scheme 을 말한다.
Sig = F sig(keccak256(RLP(T)), k) = (r, s)
서명 시에는 임시 private key q, 그리고 q로부터 생성되는 임시 public key Q 를 사용한다.
q = rand() % 2**256
Q = q * K = (x, y)
여기서 r = Q의 x 좌표이다. s는 다음으로 계산된다.
s ≡ q**-1 (Keccak-256(RLP(T)) + r * k) mod p
r, s 그리고 sender의 public key K를 사용해서 Q를 계산한다. Q의 x 좌표와 r이 같으면 서명이 유효하다.
w = s**-1 mod p
u1 = Keccak-256(RLP(T)) * w mod p
u2 = r * w mod p
Q ≡ u1 * G + u2 * K (mod p)
참고: https://github.com/ethereumbook/ethereumbook/blob/develop/06transactions.asciidoc
타원 곡선 함수, Elliptic curve cryptography 에서 다음 p를 사용
p = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1
y ** 2 mod p = (x ** 3 + 7) mod p
Private key -> Public key -> Address 로 얻는다.
k가 private key.
k = rand() % (2 ** 256), 따라서 256 bits, 64 bytes.
K가 public key로 (x, y) 좌표. G는 미리 정의된 값.
K = k * G = (x, y)
Public key, K를 표현할 때는 Standards for Efficient Cryptography (SEC1) 의 Serialized EC public key prefixes 의 prefix를 사용해서 나타낸다. 이더리움은 uncompressed point만을 지원하므로 0x04 prefix로 사용한다. 따라서 0x04 뒤에 x와 y를 concatenate한다.
0x04 | x | y
keccak-256 Hash function을 사용. Public key (x, y)를 concatenate한 값(0x04가 붙지 않았다!)을 keccak-256 로 hash 값을 얻은 후 마지막 20 바이트 값을 사용한다.
(keccak-256(x | y))[-20:]
https://github.com/ethereumbook/ethereumbook 에서 최신판을 볼 수 있다.
현재 판매되는 서적은 이전 내용을 담고 있다.
KVM 사용 시 Bridge mode로 GuestOS에 네트워크 셋팅을 해도 동작을 안하는 경우가 있다. 게이트웨이나 DNS로 ping조차 안가는데, docker 와 함께 사용 시 문제가 발생한다.
docker가 iptables 의 FORWARD chain의 정책을 DROP으로 해버리기 때문이다.
oot@justiny-desktop:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (1 references)
target prot opt source destination
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target prot opt source destination
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
다음처럼 해주면 잘된다.
# iptables -A FORWARD -i br0 -o br0 -j ACCEPT
~/.bashrc 에 다음을 추가.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
# PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]$ "
public project를 가져와서 혼자 몰래 뭘 해보고 싶을 때, Apache 2.0 License 등 derived works의 source code 공개 의무가 없는 프로젝트의 경우 private으로 바꿔서 작업을 해볼 수 있다.
다음과 같이 한다.
먼저 만들고 싶은 이름으로 github에서 project를 하나 private으로 만든다.
$ git clone --bare https://github.com/publicproject/project.git
$ cd project.git
$ git push --mirror https://github.com/myname/myproject.git
그리고 나서 실제로 clone해서 쓰면 된다.
$ git push https://github.com/myname/myproject.git
최신 코드로의 업데이트는 public repository를 여기다 remote로 추가해서 fetch & rebase하면 된다.
push는 public으로 fork해온 후 거기다 push 해서 pull request하면 될 듯.
참고: https://medium.com/@bilalbayasut/github-how-to-make-a-fork-of-public-repository-private-6ee8cacaf9d3
ssh 접속할 때마다 password 치기가 귀찮다…
클라이언트에서 키 생성
$ ssh-keygen -t rsa -N '' -q -f ~/.ssh/id_rsa
접속하려는 서버로 공개키 복사.
$ ssh-copy-id <account>@<server hostname>
위의 복사는 아래와 동등하다. 위 명령을 했다면 아래를 할 필요는 없음.
$ scp ~/.ssh/id_rsa.pub <account>@<server hostname>:.ssh/authorized_keys
예를 들면 다음과 같이 한다.
ssh-keygen -t rsa -b 4096 -q -N '' -f ~/.ssh/id_rsa_dasomoli_nas
ssh-copy-id -i ~/.ssh/id_rsa_dasomoli_nas.pub dasomoli@nas.dasomoli.org
%localappdata%\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows어쩌고저쩌고\LocalState\rootfs\
예를 들어, C:\Users\dasom\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs
\\wsl$ 를 입력하면 배포판이 보인다.
\\wsl$\Ubuntu-20.04
Xming 같은 Xserver를 사용해서 WSL로 설치한 Ubuntu 등에서 GUI 를 사용할 수 있다.
WSL로 설치한 항목은 다음으로 확인 가능하다.
wsl -l -v
여기서 WSL Version이 1인 것을 다음과 같이 2로 바꿀 수 있다. 예제로 Ubuntu-20.04 를 바꾸고 싶다면 다음과 같이 하면 된다.
wsl --set-version Ubuntu-20.04 2
명령 프롬프트에서 다음을 실행한다.
ubuntu config --default-user new_dasomoli
아래 글이 매우 정리가 잘 되어 있다.