Skip to content

Instantly share code, notes, and snippets.

View lijiext's full-sized avatar
🎯
Focusing

Li Jie lijiext

🎯
Focusing
  • Shanghai
View GitHub Profile
@lijiext
lijiext / openvscode.sh
Created May 15, 2024 06:45
OpenVSCode Server
wget https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.89.1/openvscode-server-v1.89.1-linux-arm64.tar.gz
tar -xvf openvscode-server-v1.89.1-linux-arm64.tar.gz
./openvscode-server-v1.89.1-linux-arm64/bin/openvscode-server
ssh -NfL 3000:localhost:3000 `whomi`@<ip address>
# open localhost:3000 in your browser
@lijiext
lijiext / cloudflare_zlib.sh
Last active May 15, 2024 05:46
build cloudflare zlib
lscpu | grep crc32
sudo apt install -y libzstd1 build-essential git binutils
objdump -d /usr/lib/aarch64-linux-gnu/libz.so.1 | awk -F" " '{print $3}' | grep crc32 | wc -l
mkdir tmp ; pushd tmp
git clone https://github.com/cloudflare/zlib.git
cd zlib && ./configure --prefix=$HOME/opt/apps/tools/zlib
make && make install
popd
@lijiext
lijiext / confirm.sh
Last active May 8, 2024 16:26
confirm function in shell
# Asks the user a yes/no question and waits for a response. Takes the question
# text as its only argument. The user must enter either "y" or "n" to proceed.
confirm()
{
while true; do
read -r -p "$1" RESPONSE
case "$RESPONSE" in
[yY]) return 0 ;;
[nN]) return 1 ;;
*) echo "Please enter y or n"
@lijiext
lijiext / curl_install.sh
Created May 6, 2024 03:55
compile curl for ubuntu20
wget https://curl.haxx.se/download/curl-7.68.0.tar.xz
tar -xvf curl-7.68.0.tar.xz && cd curl-7.68.0
mkdir build && cd build
../configure --prefix=`pwd`/dist --enable-threaded-resolver --with-ca-path=/etc/ssl/certs
make -j $(nproc)
make install
@lijiext
lijiext / modify_config_using_sed.md
Created April 27, 2024 15:23
modify system config using sed 使用sed命令修改配置文件,确保配置只出现一次

例如需要修改sshd_config中的某个值

#UsePAM no
UsePAM yes
#PasswordAuthentication no
PasswordAuthentication yes

先找到行号,删除原来的行,再在原来的第一行增加

@lijiext
lijiext / download_anolist_repo.sh
Created April 25, 2024 15:35
download anolist repo
#!/bin/bash
# 本地源文件路径
repo_path=/data/repos/anolis/x86_64/8
# 同步的源类型
repos=("AppStream" "BaseOS" "Extras" "Plus" "PowerTools" "kernel-5.10")
for repo in "${repos[@]}"
do
local_repo_dir="$repo_path/$repo"
mkdir -p "$local_repo_dir"
@lijiext
lijiext / extract_deb.sh
Created April 24, 2024 16:19
extract deb package
dkpg-deb -R /path/to/target.deb /path/to/extact
@lijiext
lijiext / corsscompile.make.sh
Created April 24, 2024 16:14
aarch64 cross compile example on x86 ubuntu
#!/bin/env bash
## SYSROOT was generated by
# sudo apt-get install qemu-user qemu-user-static debootstrap schroot
# sudo debootstrap --arch=arm64 focal /srv/chroot/arm64 http://ports.ubuntu.com/
##
SYSROOT=/srv/chroot/arm64
# module file for crossbuild complier
@lijiext
lijiext / extract_iso_linux.sh
Created April 24, 2024 03:50
extract iso file on linux
tar zxvf xorriso-1.4.6.tar.gz
cd xorriso-1.4.6
./configure --prefix=`pwd`/dist
xorriso -osirrox on -indev image.iso -extract / extracted_iso_image
@lijiext
lijiext / lapack_compile.sh
Created April 22, 2024 13:38
lapack编译
tar -xvf lapack-3.12.0.tar.gz
cd lapack-3.12.0
mkdir build && build
cmake -DCMAKE_INSTALL_PREFIX=./dist \
-DCBLAS=ON \
-DLAPACKE=ON \
-DCMAKE_BUILD_TYPE=RELEASE \
-DBUILD_SHARED_LIBS=ON \
../