[Ubuntu] 자동 업데이트 설정

Unattended Upgrade 설치

sudo apt update
sudo apt install unattended-upgrades

자동 업데이트 활성화

sudo dpkg-reconfigure --priority=low unattended-upgrades

설정 파일 편집: sudo vi /etc/apt/apt.conf.d/50unattended-upgrades

Unattended-Upgrade::Allowed-Origins {
    "Ubuntu stable";
    "Ubuntu ${distro_codename}-security";
    "Ubuntu ${distro_codename}-updates";
};

업데이트 주기 설정: sudo vi /etc/apt/apt.conf.d/20auto-upgrades

다음은 패키지 목록 업데이트 간격(1 = 매일), 자동 업데이트 실행 간격 (1 = 매일)

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

로그는 다음에서 확인 가능

less /var/log/unattended-upgrades/unattended-upgrades.log

자동 재부팅 설정: sudo vi /etc/apt/apt.conf.d/50unattended-upgrades

다음은 새벽 2시에 자동 리부팅.

Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "02:00";

[apt] GPG error: https://cli.github.com/packages stable InRelease 에러

apt-get update를 했는데 다음과 같은 에러가 난다.

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://cli.github.com/packages stable InRelease: 다음 서명이 올바르지 않습니다: EXPKEYSIG 23F3D4EA75716059 GitHub CLI <opensource+cli@github.com>
W: https://cli.github.com/packages/dists/stable/InRelease 파일을 받는데 실패했습니다  다음 서명이 올바르지 않습니다: EXPKEYSIG 23F3D4EA75716059 GitHub CLI <opensource+cli@github.com>
W: Some index files failed to download. They have been ignored, or old ones used instead.

기존 서명 키 삭제

sudo rm /usr/share/keyrings/githubcli-archive-keyring.gpg

최신 키 다운로드 및 설치

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /usr/share/keyrings/githubcli-archive-keyring.gpg > /dev/null
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg

/etc/apt/sources.list.d/github-cli.list 파일 안에는 이렇게 되어 있다.

deb [arch=amd64 signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main

[git] send-pack: unexpected disconnect while reading sideband packet 에러 발생 시

git push 를 했을 때, 내용이 많은 경우 다음과 같은 에러가 날 때가 있다.

error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
send-pack: unexpected disconnect while reading sideband packet

이 경우, http.postBuffer를 다음과 같이 늘려준다. 아래는 150MB.

git config --global http.postBuffer 157286400

참고: https://stackoverflow.com/questions/66366582/github-unexpected-disconnect-while-reading-sideband-packet

[ethers.js] HD wallet으로 주소 파생

12개의 seed wallet이 있는 경우, 다음과 같이 파생 주소를 확인할 수 있다.

$ npm install ethers@^5.0.0

const { ethers } = require('ethers');

// 12개의 시드 단어를 여기에 입력하세요
const mnemonic = "Your seed 12 words here";

// HD Node 생성
const hdNode = ethers.utils.HDNode.fromMnemonic(mnemonic);

// 파생 경로 설정
const derivationPath = "m/44'/60'/0'/0/"; // "m/44'/905956'/0'/0/" 와 같이 사용도 가능

// 파생 주소 생성 및 출력 함수
function generateAddresses(count) {
    const addresses = [];
    for (let i = 0; i < count; i++) {
        const walletNode = hdNode.derivePath(derivationPath + i);
        console.log(i, walletNode.address);
        addresses.push({
            index: i,
            address: walletNode.address,
        });
    }
    return addresses;
}

// 원하는 주소 개수를 설정하세요
const numAddresses = 85535;
const addresses = generateAddresses(numAddresses);

[hardhat] network forking

    hardhat: {
      chainId: 31337,
      forking: {
        url: 'http://jsonrpc.dasomoli.org:8545',
        blockNumber: 74924548,
        enabled: true,
      },
      gasPrice: 800000000000,
      hardfork: 'grayGlacier',
      chains: {
        31337: {
          hardforkHistory: {
            petersburg: 0,
            grayGlacier: 25980000,
          },
        },
      },
    },

[SpringBoot] Springboot CLI 설치

brew tap spring-io/tap
brew install spring-boot

springboot 로 bcrypt 패스워드 인코딩을 하려면, 다음과 같이 하면 된다.

spring encodepassword super1234!!

https://docs.spring.io/spring-boot/docs/current/reference/html/cli.html 를 참고.