command list

#conda activate:
source /opt/anaconda/bin/activate google

commen MySQL command

sql account and password
root@localhost: Ub<%Jpueg56L
#Automatically enable mysql when system startup
sudo systemctl enable mysqld.service
#Start the MySQL service
sudo systemctl start mysqld.service
#View the MySQL service status
systemctl status mysqld.service

labelme manual

#activate anaconda
source /opt/anaconda/bin/activate google
# install labelme
pip install labelme
#open
lable

use ffmpeg

#ffmpeg merge videos
for f in *.mp4; do echo "file '$f'" >> files.txt; done
ffmpeg -f concat -i files.txt -c copy output.mp4
#ffmpeg merge audio
for f in *.mp3; do echo "file '$f'" >> files.txt; done
ffmpeg -f concat -i files.txt -c copy output.mp3
#cut video
#-ss start time
#-t  duration
ffmpeg -ss 0:1:30 -t 0:0:20 -i input.avi -vcodec copy -acodec copy output.avi
#Video and audio encapsulation
ffmpeg –i video_file.mp4 –i audio_file.mp3 –vcodec copy –acodec copy output_file.mp4
#Separate video audio streams
ffmpeg -i input_file -vcodec copy -an output_file_video.mp4  #Separate the video stream
ffmpeg -i input_file -acodec copy -vn output_file_audio.mp3  #Separate the audio stream
#video demux(compress and decompress)
ffmpeg –i test.mp4 –vcodec copy –an –f m4v test.264
ffmpeg –i test.avi –vcodec copy –an –f m4v test.264
#Video transcoding
#Transcode to the original file of the stream
ffmpeg –i test.mp4 –vcodec h264 –s 352*278 –an –f m4v test.264
#Transcode to the original file of the stream
#-bf B frame number control, -g key frame interval control, -s resolution control
ffmpeg –i test.mp4 –vcodec h264 –bf 0 –g 25 –s 352*278 –an –f m4v test.264
#Transcode to an encapsulation file
ffmpeg –i test.avi -vcodec mpeg4 –vtag xvid –qsame test_xvid.avi
#Convert videos to mp3
ffmpeg -i Bob_Proctor.mp4 -vn bob_proctor.mp3
#Replace audio in video with audio.wav audio
ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 output.mp4
#convert mov to mp4
ls *mov|while read id;do (ffmpeg -i  "$id" -vcodec libx264 -preset fast -crf 20 -y -vf "scale=1920:-1" -acodec libmp3lame -ab 128k   "${id%%.*}.mp4"  );done

dart web error :Can’nt open dart web serve

pub global activate webdev
webdev serve

yay command

#Example 1: Install package using yay
#Use the option `-S` to install a package from AUR using yay.
yay -S package
#Example 2: Remove package using yay
#To remove a package, use `-Rns` options:
yay -Rns package
#Example 3: Launch a package selection menu
yay <Search Term>
#Example 4: Upgrade installed packages using yay
#To upgrade all installed packages, use the options :
yay -Syu
#To include development packages, use:
yay -Syu --devel --timeupdate
#Example 5: Cleans unneeded dependencies using yay
#Use the options to remove all unneeded dependencies on your system:
yay -Yc
#remove all of these unnecessary packages with the following command:
sudo pacman -R $(pacman -Qdtq)
#Example 6: Prints system statistics using yay
#To print system stats, use `-Ps`
yay -Ps
#Example 7: Generates development package DB used for devel updates
yay -Y --gendb
#Clean the cache
yay -Scc

git useage

#install git-lfs
yay -S git-lfs
git init
git lfs track "*.ipynb" "*.zip" "*.7z"
#使用git clone命令来克隆LFS仓库,例如:
git clone https://github.com/user/repo.git
#进入刚刚克隆的仓库目录
cd repo
git lfs fetch
#通过上述命令,Git LFS将下载所有在仓库中使用的LFS对象。
#通过git lfs checkout命令来检出LFS对象,例如:
#git lfs checkout
#Git LFS将把所有LFS对象从本地存储中检出到您的工作目录中。
git add .
git commit -m "python_code"
git remote add origin git@e.coding.net:googleteam/data_mining/python_code.git
git push -u origin master
#create repo commmand line
git push --set-upstream git@gitcode.net:dnrops/$(git rev-parse --show-toplevel | xargs basename).git $(git rev-parse --abbrev-ref HEAD)
#remove remote origin
git remote rm origin
#all in one line
git init && git add . && git commit -m "bookmark" && git remote add origin git@e.coding.net:googleteam/my_code/book_mark.git && git push -u origin master
#pull from repo
git pull origin main
#switch branch
git branch -M main
#push to repo
git push -uf origin main
#https://bitbucket.org/dashboard/repositories
FQXwgrR7AcVF6K2dMqe5
#https://code.educoder.net/
U:pef9toi32
P:m...
#github
yay -S github-cli
github token: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
gh auth login
git config --global user.email "dnrops@outlook.com"
git config --global user.name "dnrops"

linux find dir or file

find ./code -name .git  -d
find ./code -name command_list.md -d

File statistics

# Displays the size of the current folder
du -sh
# Lists the size of each directory under the current folder
du -lh --max-depth=1
# Lists the space usage of the current file system
df -lh

View disk useage

yay -S baobab
baobab

Open sunloginclient

systemctl start runsunloginclient.service
sunloginclient

Conda env

yay -S miniconda
# conda
export PATH="/opt/miniconda/bin:$PATH"
conda config --set show_channel_urls yes
#add to ~/.condarc
```
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.zju.edu.cn/anaconda/pkgs/main
- https://mirrors.zju.edu.cn/anaconda/pkgs/r
- https://mirrors.zju.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.zju.edu.cn/anaconda/cloud
msys2: https://mirrors.zju.edu.cn/anaconda/cloud
bioconda: https://mirrors.zju.edu.cn/anaconda/cloud
menpo: https://mirrors.zju.edu.cn/anaconda/cloud
pytorch: https://mirrors.zju.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.zju.edu.cn/anaconda/cloud
simpleitk: https://mirrors.zju.edu.cn/anaconda/cloud
```
#conda activate:
source /opt/anaconda/bin/activate google
#create conda environment
conda create -n env_name python=3.7
#remove conda environment
conda remove -n your_env_name --all
#remove conda environments package
conda remove --name $your_env_name  $package_name
#exit conda environment
#Linux:
source deactivate your_env_name
#Windows:
deactivate env_name

nvim init.vim

/home/andry/.config/nvim/init.vim
map td :tabnew .<cr>
map tp :tabprevious <cr>
map tn :tabnext<cr>
map jk :w!<cr>
map <C-F> :!cargo fmt<cr>
map <C-R> :!cargo fmt && cargo run<cr>

install QQ

yay -S deepin-wine-qq

install wechat

#https://github.com/vufa/deepin-wine-wechat-arch/releases
yay -S deepin-wine6-stable
yay -S deepin-wine-helper
wget https://gitcode.net/dnrops/atom_bin/-/raw/master/wechat/deepin-wine-wechat-3.7.6.44-1-x86_64.pkg.tar.zst
yay -U deepin-wine-wechat-3.7.0.29-1-x86_64.pkg.tar.zst
duma https://ghproxy.com/https://github.com/vufa/deepin-wine-wechat-arch/releases/download/v3.7.6.44-1/deepin-wine-wechat-3.7.6.44-1-x86_64.pkg.tar.zst

install rust crates.io token

export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
yay -S rustup
yay -S rust-analyzer-nightly
rustup install nightly
https://crates.io/settings/tokens

cargo install loop

echo '\nexport PATH="~/.cargo/bin:$PATH"' >> ~/.bashrc
echo '\nexport PATH=\"~/.cargo/bin:\$PATH\"' >> ~/.bashrc
echo '\nexport RUSTUP_DIST_SERVER=\"https://mirrors.tuna.tsinghua.edu.cn/rustup\"' >> ~/.bashrc
echo '\nexport RUSTUP_UPDATE_ROOT=\"https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup\"' >> ~/.bashrc
curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh -s -- -y
source "$HOME/.cargo/env"
while true
do
cargo install hex_dump --force
cargo install base64_img_cli --force
cargo install base64_text --force
cargo install base64_text --force
cargo install xl_to_csv --force
cargo install serve-cli --force
cargo install ghc --force
cargo install npms --force
cargo install bili_search --force
cargo install mook --force
cargo install pdf_cli --force
cargo install look_ip --force
done

yarn and npm

yarn config get registry
npm config get registry
yarn config set registry http://registry.npmmirror.com
npm config set registry http://registry.npmmirror.com
//恢复官方源
yarn config set registry https://registry.yarnpkg.com
npm config set registry https://registry.npmjs.org
npm config set registry https://mirrors.sjtug.sjtu.edu.cn/npm-registry
yarn config set registry https://mirrors.sjtug.sjtu.edu.cn/npm-registry
#npm login 需要恢复官方源
U:dnrops
P:m...
email:dnrops@outlook.com
one-time-code from iphone:**

Angular

#While creating a new project
ng new angularguard
#Component
ng generate component components/footer --module=app.module //optional
ng generate component components/footer
ng g c articles/git/git_guide
#Service
ng generate service service/ui
#Test dist
serve dist/
#json-serve
#install
npm i json-server
#package.json add
"server": "json-server --watch db.json --port 7000"
#and run
yarn server
#use antidesign in angular
ng g ng-zorro-antd:notification-with-icon anticomponent/false --module=app.module
#Angular开发,提示 Object is possibly 'null' 恼人的提示,谁有那时间写出完美的代码呢,有null是正常的。这提示该关闭。网上找到了关闭的方法:
tsconfig.json > compilerOptions, 增加:
"strictNullChecks":false
# angular pulish to github
#把生成的inde.html 复制成404.html ,把整个docs 文件夹里的资源上传就好了
ng build --output-path docs --base-href /alenandry.github.io/
# pulish GitHub Pages
git push -u origin main

Vscode save and run command

1.install the ext install wk-j.save-and-run 2.add to settings.json

atom ~/.config/Code/User/settings.json
//saveAndRun
{
"saveAndRun": {
"commands": [
{
"match": "Demo.tex",
"cmd": "bash compile.sh",
"useShortcut": false,
"silent": false
}
]
}
}

latex commen syntax

一行对齐
\leftline{左对齐}
\centerline{居中}
\rightline{右对齐}
多行或者段落对齐
左对齐 \begin{flushleft}...\end{flushleft}
居中 \begin{center}...\end{center}
右对齐 \begin{flushright}...\end{flushright}
加粗 \textbf{步骤3:}

fast delete some folder

#copy save to delete.sh   bash delete.sh ./some_ir
mkdir empty && rsync -r --delete empty/ $1 && rmdir $1
rmdir empty

record screen and save .gif

yay -S peek
peek

simple screenshot sotfware

yay -S xfce4-scrennshoter

image-20220310093334431.png s

linux add font

wget https://gitcode.net/dnrops/fonts/-/raw/master/autobus/Autobusbold-1ynL.ttf
#create dir
sudo mkdir /usr/share/fonts/Autobusbold
#mv font file to dir
mv ./Autobusbold-1ynL.ttf /usr/share/fonts/Autobusbold/simhei.ttc
#give font file permission, (only the owner have read and write access)
sudo chmod 644 /usr/share/fonts/Autobusbold/*
#update fonts
sudo mkfontscale
sudo mkfontdir
sudo fc-cache -fsv

linux dns

atom  /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.77.75

run matlab in linux

ocsptool
octave-cli
octave-config
octave-statistics

docker

#Switch to the root user first, and then execute the following command
su root
ubuntu{
systemctl unmask docker.service
systemctl unmask docker.socket
systemctl start docker.service
}
archliux{
#automaticaly start in docker
systemctl enable docker
# start docker
systemctl start docker
# restart dokcer
systemctl restart docker
}
#/etc/docker/daemon.json 中写入
{
"registry-mirrors": [
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com"
]
}
#reboot docker after set mirror
sudo systemctl daemon-reload
sudo systemctl restart docker
#start open in terminal
docker run -it zinso/rust_nightly
#start run in backgroud
docker run -d zinso/rust_nightly
#dock image change_mirrorlist
curl --proto '=https' --tlsv1.2 -sSf https://gitcode.net/dnrops/mirrorlist/-/raw/master/change_mirorlist.sh | sh
#get image iD and status
docker ps
#save changed image
#docker commit <container_id> <image_name>
docker commit 6247746ea21b archlinux
#viewe all images
docker images
#build from Dockerfile
docker build -t latest .
#docker remove all images and cache
docker system prune
#Check for running containers:
docker ps
#List all containers running on the host for deletion:
docker ps -a
#Stop a running container:
docker stop <CONTAINER ID>
#Killing still running containers:
docker kill <CONTAINER ID>
#Delete containers listed by ID:
docker rm <CONTAINER ID>
#List all Docker images:
docker images
#Delete images by ID:
docker rmi <IMAGE ID>
#Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
docker system prune
#To additionally remove any stopped containers and all unused images (not just dangling ones), add the -a flag to the command:
docker system prune -a
#Delete all Docker data (purge directory):
rm -R /var/lib/docker

deno change mirror

##change
https://deno.land/std/
##to
https://gitcode.net/dnrops/deno_std/-/raw/main/

my ~/.bashrc

# ~/.bashrc
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
[[ -f ~/.welcome_screen ]] && . ~/.welcome_screen
_set_liveuser_PS1() {
PS1='[\u@\h \W]\$ '
if [ "$(whoami)" = "liveuser" ] ; then
local iso_version="$(grep ^VERSION= /usr/lib/endeavouros-release 2>/dev/null | cut -d '=' -f 2)"
if [ -n "$iso_version" ] ; then
local prefix="eos-"
local iso_info="$prefix$iso_version"
PS1="[\u@$iso_info \W]\$ "
fi
fi
}
_set_liveuser_PS1
unset -f _set_liveuser_PS1
ShowInstallerIsoInfo() {
local file=/usr/lib/endeavouros-release
if [ -r $file ] ; then
cat $file
else
echo "Sorry, installer ISO info is not available." >&2
fi
}
alias ls='ls --color=auto'
alias ll='ls -lav --ignore=..'   # show long listing of all except ".."
alias l='ls -lav --ignore=.?*'   # show long listing but no hidden dotfiles except "."
[[ "$(whoami)" = "root" ]] && return
[[ -z "$FUNCNEST" ]] && export FUNCNEST=100          # limits recursive functions, see 'man bash'
## Use the up and down arrow keys for finding a command in history
## (you can write some initial letters of the command first).
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
################################################################################
## Some generally useful functions.
## Consider uncommenting aliases below to start using these functions.
##
## October 2021: removed many obsolete functions. If you still need them, please look at
## https://github.com/EndeavourOS-archive/EndeavourOS-archiso/raw/master/airootfs/etc/skel/.bashrc
_open_files_for_editing() {
# Open any given document file(s) for editing (or just viewing).
# Note1:
#    - Do not use for executable files!
# Note2:
#    - Uses 'mime' bindings, so you may need to use
#      e.g. a file manager to make proper file bindings.
if [ -x /usr/bin/exo-open ] ; then
echo "exo-open $@" >&2
setsid exo-open "$@" >& /dev/null
return
fi
if [ -x /usr/bin/xdg-open ] ; then
for file in "$@" ; do
echo "xdg-open $file" >&2
setsid xdg-open "$file" >& /dev/null
done
return
fi
echo "$FUNCNAME: package 'xdg-utils' or 'exo' is required." >&2
}
#------------------------------------------------------------
## Aliases for the functions above.
## Uncomment an alias if you want to use it.
##
# alias ef='_open_files_for_editing'     # 'ef' opens given file(s) for editing
# alias pacdiff=eos-pacdiff
################################################################################
alias yay_cache="thunar ~/.cache/yay/"
alias paru_cache="thunar ~/.cache/paru/"
alias open_mirror="atom /etc/pacman.d/mirrorlist"
alias open_markdown="thunar /run/media/andrew/DATA/code/rust_code/rust_fontend/dioxus_blog/src/markdown_files/"
alias clear_cargo_cache="rm -rf ~/.cargo/.package-cache"
alias clear_pacman="sudo rm -rf /var/lib/pacman/sync/*"
alias fast_download="duma -U Chrome/51.0.2704.103 -c -n 1000 -T 5000"
alias tt="sogou_translate_cli -m "
alias open_command="typora ~/code/gitcode/my_command_list/README.md"
#git path
export PATH="/usr/bin/git:$PATH"
#deno path
export PATH="/home/andrew/.deno/deno_bin:$PATH"
#rustup
export RUSTUP_UPDATE_ROOT="https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup"
export RUSTUP_DIST_SERVER="https://mirrors.tuna.tsinghua.edu.cn/rustup"
#rust
export PATH="/home/andrew/.cargo/bin:$PATH"
#hx path
export PATH="/home/andrew/.config/helix:$PATH"
#ruby path
export PATH="/home/andrew/.local/share/gem/ruby/3.0.0/bin:$PATH"
#starship
eval "$(starship init bash)"
#webpack error
export NODE_OPTIONS=--openssl-legacy-provider
# Load Angular CLI autocompletion.
source <(ng completion script)

nushell

#How to list your environment variables
$env
#add to env
let-env PATH = ($env.PATH | append "some/other/path")

fast github

https://hub.fastgit.xyz/
https://hub.xn--p8jhe.tw/
https://hub.xn--gzu630h.xn--kpry57d/
https://hub.nuaa.cf/

install and configure starship && nushell

#starship
cargo install starship --locked
#add to ~/.bashhrc
eval "$(starship init bash)"
#open starship.toml and add
atom ~/.config/starship.toml
##add to starship.toml
"$schema" = 'https://gitlab.com/andrew_ryan/rust_code/-/raw/master/rust_codewar/config-schema.json'
scan_timeout = 1000
command_timeout = 100000
##
#nushell
$nu.config-path #get config path
atom /home/andrew/.config/nushell/config.nu
/home/andrew/.config/nushell/env.nu
/home/andrew/.config/nushell/config.nu
#run the command add add to config.nu
starship init nu | save ~/.cache/starship/init.nu
##add to ~/.cache/starship/init.nu
source ~/.cache/starship/init.nu
alias yay_cache = (thunar  "~/.cache/yay/")
alias pacman_mirror = (atom "/etc/pacman.d/mirrorlist")
alias open_mirror = (atom "/etc/pacman.d/mirrorlist")
alias open_cargo_config = (atom "~/.cargo/config")
alias clear_cargo_cache = (rm -rf "~/.cargo/.package-cache")
alias fast_download = duma -U Chrome/51.0.2704.103 -c -n 1000 -T 5000
alias tt = sogou_translate_cli -m
##

install endeaver linux

#1.open gparted partition free disk
#2.open installer
#3.add each partition flag
#4.after instalation done reboot
#5.change mirror
#6.install sougoupinyin
#7.install screenshot:  flameshot -gui =>>start
#8.install microsoft-ede-browser
#9.install rust
#10.install miniconda and add mirror
#11.yay -S xfce4-clipman-plugin  to install clipboard maneger
#12.install eye protection: yay -S safeeyes || yay -S redshift
#13.open eye protection redshift -P -O 3000
yay -S fcitx fcitx-qt6 fcitx-qt5 fcitx-configtool fcitx-im clang lld  xfce4-clipman-plugin fcitx-sogoupinyin deno cmake redshift obs-studio deepin-wine-wechat mpv flameshot git-lfs upx linux-wifi-hotspot paru wasm-bindgen dart-sass wasmer
yay -S whitesur-icon-theme feishu-bin google-chrome microsoft-edge-stable-bin
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
git config --global user.email "dnrops@aliyun.com"
git config --global user.name "dnrops"

dexios encriypt

#install
cargo install dexios
#encrypt folder to .7z compress level=9 递归加密
dexios pack -r --level=9 -ea2 ./demo/ ./demo.7z
#decrypt encrypted .7z to folder
dexios pack -r --level=9 -d ./demo.7z ./demo
#To just encrypt a file:
dexios -e test.txt test.enc
#To just decrypt a file:
dexios -d test.enc test.txt
#To just erase a file:(delete file)
dexios erase test.txt
#To list all possible AEADs:
dexios list aead
#To pack and encrypt a folder:
dexios pack encrypt test/ file.encrypted
#To decrypt and unpack a folder:
dexios pack decrypt file.encrypted test/
#To encrypt a file using (note: you do not need to specify when decrypting):AES-256-GCM-a
dexios -ea2 test.txt test.enc
#To encrypt a file, and show the hash of the encrypted (output) file for verification later on:
dexios -eH test.txt test.enc
#To decrypt a file, and show the hash of the encrypted file (to compare with the hash generated above):
dexios -dH test.enc test.txt
#To encrypt a file, and erase the original file:
dexios -e --erase test.txt test.enc
#To use a keyfile for encryption:
dexios -ek keyfile test.txt test.enc

iso crate usb system booter

yay -S etcher-bin

genarate GPG key

gpg --full-generate-key # choose  (1) RSA and RSA (default)
gpg --list-secret-keys --keyid-format=long #list valid keys and show id
gpg --armor --export dnrops #show publick key ,dnrops is id
#delete by [key_id]
gpg --delete-secret-key 78FDEF1E42F50BF16542D4AB5B15C5DE1E4847BF

genate SSH key

#linux
ssh-keygen -t ed25519 -C "dnrops_anonymous@tutanota.com"  #generate ssh key
cat /home/andrew/.ssh/id_ed25519.pub  #show ssh key
#windows
ssh-keygen.exe
cat  C:\Users\Administrator/.ssh/id_rsa.pub

Use helix

space+y  =>yank to system clipboard
space+w+l =>change vs to left
space+w+h =>change vs to right
space+/ =>global search
space+k =>Show docs for item under cursor
space+r =>Rename symbol under cursor letter
e => next word
b => previos word
c => retype current word
r => replease current letter
g+d  =>Goto code definition
g+n  =>Goto next buffer
g+p  =>Goto previous buffer(back to current code)
## for Rust
yay -S rust-analyzer
yay -S lldb

re-generate GRUB config

#每次安装或者移除一个内核后,你都需要重新运行一次 grub-mkconfig 命令
sudo grub-mkconfig -o /boot/grub/grub.cfg

rust add wasm32

# download lib.7z and  copy to /home/andrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/ folder
# /home/andrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib
# or run the command
rustup target add wasm32-unknown-unknownwn

cargo config

[source.crates-io]
replace-with = "rsproxy"
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
[source.bfsu]
registry = "https://mirrors.bfsu.edu.cn/git/crates.io-index.git"
[source.hit]
registry = "https://mirrors.hit.edu.cn/crates.io-index.git"
[source.nju]
registry = "https://mirror.nju.edu.cn/git/crates.io-index.git"
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
[net]
retry = 3                   # network retries
git-fetch-with-cli = true   # use the `git` executable for git operations
[alias]                 # command aliases
b = "build"
c = "check"
t = "test"
r = "run"
rr = "run --release"
br = "build --release"
[build]
jobs = 8                      # number of parallel jobs, defaults to # of CPUs
rustc = "rustc"               # the rust compiler tool
rustdoc = "rustdoc"           # the doc generator tool
target-dir ="rust_target"
rustdocflags = ["--default-theme", "coal"]
[doc]
browser = "chromium"
[profile.dev]
opt-level = 0
debug = 2
incremental = true
[profile.release]
codegen-units = 1
strip = true
panic = "abort"
lto = true
incremental = false
opt-level = "s"
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
[llvm]
link-shared= true

linux set dns

# atom /etc/resolv.conf
# Generated by NetworkManager
search bbrouter
#nameserver 192.168.1.1
nameserver 119.29.29.29 #tencen dns

npmjs.com recover code

#Two-Factor Authentication
#open iphone setting paswords and find npmjs.com open to see Verification Code
307d732f2744233108e5e13c8b9ee3d77ae466c332a270f78d42800f69fd316d
90e9b65e5ffe2d2cb48654e849a91bd91837fea0ef004b7f92694e842688abe2
43f974262bc32574be7d5d3edb54d7a17c48ee609191a19ba329b8dd4544bb54
de46374d822cc274364fb497d8fc5a8c4dd46f3d4caeeaf7c42a4c9dcba92feb
12c0f55f1dc3902248fba5af4c51dd65a1c701a480f3666ba138bc68a148e500

start local serve

#install
npm install -g local-web-server
#start
ws --qr

hosts

#/etc/hosts
# Standard host addresses
127.0.0.1  localhost
::1  localhost ip6-localhost ip6-loopback
ff02::1  ip6-allnodes
ff02::2  ip6-allrouters
127.0.1.1  andrew-lap
140.82.113.3  alive.github.com
140.82.113.3  live.github.com
140.82.113.3  central.github.com
3.235.146.215  desktop.githubusercontent.com
140.82.113.3  assets-cdn.github.com
3.236.219.148  camo.githubusercontent.com
151.101.1.6  github.map.fastly.net
151.101.1.6  github.global.ssl.fastly.net
140.82.113.3  gist.github.com
185.199.108.153  github.io
140.82.113.3  github.com
192.0.66.2  github.blog
140.82.113.3  api.github.com
3.238.199.124  raw.githubusercontent.com
18.206.187.210  user-images.githubusercontent.com
44.211.98.74  favicons.githubusercontent.com
18.232.31.239  avatars5.githubusercontent.com
44.197.117.33  avatars4.githubusercontent.com
35.168.112.147  avatars3.githubusercontent.com
3.233.233.24  avatars2.githubusercontent.com
44.197.117.33  avatars1.githubusercontent.com
3.214.224.150  avatars0.githubusercontent.com
3.238.254.30  avatars.githubusercontent.com
140.82.113.3  codeload.github.com
72.21.206.80  github-cloud.s3.amazonaws.com
72.21.206.80  github-com.s3.amazonaws.com
72.21.206.80  github-production-release-asset-2e65be.s3.amazonaws.com
72.21.206.80  github-production-user-asset-6210df.s3.amazonaws.com
72.21.206.80  github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153  githubstatus.com
140.82.113.18  github.community
52.224.38.193  github.dev
140.82.113.3  collector.github.com
3.238.254.30  pipelines.actions.githubusercontent.com
34.204.193.153  media.githubusercontent.com
100.26.176.110  cloud.githubusercontent.com
44.200.25.133  objects.githubusercontent.com
13.107.219.40  vscode.dev
13.225.103.88  static.rust-lang.org
104.192.141.1  bitbucket.org
34.120.231.152  gitpod.io
148.153.56.162  bilicdn1.com
23.236.97.62  bilibili.com
142.250.190.3  google.cn
172.65.253.13  deepl.com
78.31.64.14  mail.ipaddress.com
18.232.245.187  g.ezoic.net
18.67.76.44  mxtoolbox.com
119.3.229.170  gitcode.net
34.120.54.55  deno.land
172.253.115.100  cloud.google.com
3.234.104.255  ipaddress.com
172.66.43.71  codewars.com
54.192.150.28  docs.rs
172.66.40.185  www.codewars.com
192.227.67.57  handwiki.org
95.216.144.15  aur.archlinux.org
13.107.21.200  cn.bing.com
64.71.144.205  users.rust-lang.org
101.6.15.130  mirrors.tuna.tsinghua.edu.cn
173.236.212.42  typora.io
140.82.113.4  central.github.com
140.82.113.4  assets-cdn.github.com
151.101.1.6  github.map.fastly.net
151.101.1.6  github.global.ssl.fastly.net
140.82.113.4  gist.github.com
185.199.108.153  github.io
140.82.113.4  github.com
140.82.113.4  api.github.com
140.82.113.4  codeload.github.com
72.21.206.80  github-cloud.s3.amazonaws.com
72.21.206.80  github-com.s3.amazonaws.com
185.199.108.153  githubstatus.com
140.82.113.18  github.community
140.82.113.4  raw.github.com
104.18.2.36  sourcegraph.com
199.59.149.235  hellogithub.com
104.16.19.35  registry.npmjs.org
172.65.251.78  gitlab.com

beave browser sync code

wedding course business define ramp they dad forward artwork space oil flame civil knock aware purpose canvas warm flush physical spot pull swap such bag

UI design

Glassmorphism(毛玻璃效果) and Neumorphism(新拟物)

grub2 add win11 menuentry

#path
#sudo nano /boot/grub/grub.cfg
menuentry 'EndeavourOS Linux, with Linux linux' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-aa2a25bd-0ca9-488d-8249-eea80256b692' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root aa2a25bd-0ca9-488d-8249-eea80256b692
echo    'Loading Linux linux ...'
linux   /boot/vmlinuz-linux root=UUID=aa2a25bd-0ca9-488d-8249-eea80256b692 rw  loglevel=3 nowatchdog nvme_load=YES nvidia-drm.modeset=1
echo    'Loading initial ramdisk ...'
initrd  /boot/intel-ucode.img /boot/initramfs-linux.img
}
menuentry 'EndeavourOS Linux, with Linux linux (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-aa2a25bd-0ca9-488d-8249-eea80256b>
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root aa2a25bd-0ca9-488d-8249-eea80256b692
echo    'Loading Linux linux ...'
linux   /boot/vmlinuz-linux root=UUID=aa2a25bd-0ca9-488d-8249-eea80256b692 rw  loglevel=3 nowatchdog nvme_load=YES nvidia-drm.modeset=1
echo    'Loading initial ramdisk ...'
initrd  /boot/intel-ucode.img /boot/initramfs-linux-fallback.img
}
##添加 01E7-0316 是EFI分区的UUID gpated info 可以查到
menuentry 'Microsoft Windows 11' {
insmod part_gpt
insmod fat
insmod search_fs_uuid
insmod chain
search --no-floppy --fs-uuid --set=root 01E7-0316
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

Rust static build

#add to .bashrc
#rustup
export RUSTUP_UPDATE_ROOT="https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup"
export RUSTUP_DIST_SERVER="https://mirrors.tuna.tsinghua.edu.cn/rustup"
#install
yay -S zig
yay -S llvm
yay -S openssl
yay -S rust-std-nightly-x86_64-unknown-linux-musl
rustup component add rustfmt-preview
rustup component add rls-preview
rustup component add clippy-preview
ustup component add llvm-tools-preview
rustup target add x86_64-unknown-linux-musl --toolchain=nightly
rustup default nightly-x86_64-unknown-linux-musl
cargo install cargo-zigbuild
cargo build --target x86_64-unknown-linux-musl
#or
./build
#second solution is better
docker pull ekidd/rust-musl-builder:latest
docker run --rm -it -v "$(pwd)" ekidd/rust-musl-builder
alias rust-musl-builder='docker run --rm -it -v <Cargo.toml path> ekidd/rust-musl-builder'
alias rust-musl-builder='docker run --rm -it -v /workspace/gap/lookup ekidd/rust-musl-builder'
rust-musl-builder cargo build --release

build.sh

#!/usr/bin/env bash
set -e
USER=andrew
HOME=/home/andrew
PATH="$HOME/.cargo/bin:$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export OPENSSL_DIR=/usr
# sudo chown -R $USER:$USER target/
sudo chown -R $USER:$USER $HOME/.cargo/registry
# all three environment variables must be present to coerce it to static link
exec bash -lc '
OPENSSL_DIR=/usr\
cargo zigbuild --target=x86_64-unknown-linux-musl --release;
'

Rust reqwest static link error because of require openssl so use ureq insted

fn main() {
run().unwrap();
}
#[allow(warnings)]
fn run() -> Result<(), Box<dyn std::error::Error>> {
use std::time::Duration;
use ureq::{Agent, AgentBuilder};
let agent: Agent = ureq::AgentBuilder::new()
.timeout_read(Duration::from_secs(5))
.timeout_write(Duration::from_secs(5))
.build();
let body: String = agent
.get("http://open.iciba.com/dsapi/?date=2022-05-03")
.call()?
.into_string()?;
println!("{}", body);
Ok(())
}

mac commands

#show info
brew info firefox
#install
brew install firefox
#clean brew
brew cleanup --prune=all
#clean brew

use pyenv

#add to bash_profile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
pyenv install -l   #list all python
pyenv install pypy2.7-7.3.8   #install py27
pyenv versions
pyenv shell system
pyenv shell pypy2.7

publish aur package

image-20230829233959130

ssh-keygen -f ~/.ssh/aur
#add ssh key to aur account
cat ~/.ssh/aur.pub
cargo install aur_cli
yay -S aur_cli
makepkg --printsrcinfo > .SRCINFO
git clone git+ssh://aur@aur.archlinux.org/{pkg_name}
updpkgsums
ppush new
#other solution is install rust-aur
cargo install --git https://gitcode.net/dnrops/rust-aur-git.git
yay -S rust-aur-git
arg1 is rust project addres arg2 is cli name
rust-aur https://gitcode.net/dnrops/terminal-gpt-git.git terminal-gpt

install swift in archlinux

wget https://gitcode.net/dnrops/swift-bin/-/raw/10482cfc4feaeca4dbcccfda68d2c330e1d618cf/swift-bin-5.6-1-x86_64.pkg.tar.zst
yay -U swift-bin-5.6-1-x86_64.pkg.tar.zst
sudo ln -s /usr/lib64/libpython3.11.so.1.0 /usr/lib64/libpython3.6m.so.1.0

start postgresql

To start postgresql@14 now and restart at login:
brew services start postgresql@14
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14

java set mvn and set mutilple jdk

#install jdk8
yay -S jdk8-openjdk
#install jdk20
yay -S archlinuxcn/jdk
#get jdk list
archlinux-java status
#set jdk
sudo archlinux-java set java-8-openjdk
sudo archlinux-java set java-20-jdk

start ssh server and connect

#start ssh server
sudo systemctl start sshd
# connect ssh server
ssh andrew@172.20.10.2
OR
ssh andrew@$(ifconfig wlan0 | grep 'inet ' | awk '{print $2}')

install tools for bluetooth earphone

yay -S bluez bluez-utils bluez-firmware pulseaudio-bluetooth pavucontrol pulseaudio-alsa

start bluetooth server

systemctl enable bluetooth
systemctl start bluetooth

start pulseaudio

pulseaudio -k                   # 确保没有pulseaudio启动
pulseaudio --start              # 启动pulseaudio服务

start firewall

# 添加白名单地址
firewall-cmd --permanent --add-source=192.168.1.100
# 将允许的IP或者IP段加入trusted白名单
firewall-cmd --permanent --add-source=192.168.1.15 --zone=trusted
# 放行IP:允许指定IP,所有端口都可以访问
firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address="1.1.1.1" accept"
# 对外暴露8787端口,即任意ip都能访问
firewall-cmd --permanent --add-port=8787/tcp --zone=public

manually mount disk

# get disk list and device name
sudo fdisk -l
# mount /dev/sdb1 to /home/andrew/SDB/
sudo mount /dev/sdb1 /home/andrew/SDB/ -t auto

powershell set ExecutionPolicy

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope UserPolicy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned  -Scope MachinePolicy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Get-ExecutionPolicy -List