neofetch #
neofetch
cd #
cd [directory]
chmod #
sudo chmod +x [file]
md5 #
md5 [file]
sha256sum #
sha256sum [file]
sha512sum [file]
homebrew #
brew install [package]
brew upgrade
brew cleanup
aria2c #
aria2c -x 16 -s 16 [url]
youtube-dl #
Video #
youtube-dl -i [url]
Audio Only #
youtube-dl -x [url]
Premium #
youtube-dl [url] \
--format bestvideo+bestaudio \
--write-thumbnail \
--cookies=cookiejar.txt \
--limit-rate 2M
ydl+aria2c #
youtube-dl [url] \
--external-downloader aria2c\
--external-downloader-args "-x 16 -k 1M"\
--format bestvideo+bestaudio \
--write-thumbnail
ffmpeg #
Download .m3u8 #
ffmpeg -i [url] -c copy [file]
example
ffmpeg -i "https://xxx.com/index.m3u8" -codec copy "out.mp4"
Convert File Formats #
from .mp4 to .mp3:
ffmpeg -i a.mp4 a.mp3
from .mp4 to .gif
ffmpeg -i a.mp4 a.gif
Cut Parts of a Video #
ffmpeg -ss 00:00:00 -t 00:00:30 -i test.mp4 -vcodec copy -acodec copy output.mp4
Increase Volume in Audio #
ffmpeg -i "a.mp3" -filter:a "volume=2.0" "a2.mp3"
Rotating Videos #
ffmpeg -i input.mp4 -vf "rotate=270*(PI/180)" output.mp4
img2pdf #
img2pdf img1.png img2.jpg -o out.pdf
img2pdf *.png -o out.pdf
ocrmypdf #
ocrmypdf -l chi_sim+eng <input_file.pdf> <output_filename.pdf>
magic-wormhole #
wormhole send <file>
Set Proxy in Terminal #
export https_proxy=http://<host>:<port> http_proxy=http://<host>:<port> all_proxy=socks5://<host>:<port>
Python #
python *.py
7z #
a : Add files to archive
t{Type} : Set type of archive
cd box ## box is the name of a new folder
./7zz a -t7z "test.7z" "file"
./7zz a -t7z "box/fodler.7z" "box/folder"
Compress with password protection #
./7zz a -t7z -p123456789 "box/test.7z" "box/testex.md"
List contents of archive #
./7zz l "box/3.7z"
Uncompress #
x : extract files with full paths
./7zz x -t7z -p123456789 "box/test.7z"
-o{Path} : designate a directory
./7zz e "box/12.7z" "box/12/1.md"
./7zz e "box/12.7z" -obox "box/12/1.md"
Volumes #
分卷压缩
-v{Size}[b|k|m|g] : Create volumes
./7zz a -t7z "box/1.7z" "box/1.mp4" -v1m -v1m -v1m
x: extract volumes
./7zz x "box/1.7z.001"
grep #
search content in large volume files
grep "match_pattern" file_name
docker-compose #
docker-compose up -d
docker-compose down
ssh #
Generate an SSH key pair
ssh-keygen -t ed25519 -C "<comment>" ##ED25519
ssh-keygen -t rsa -b 2048 -C "<comment>" ##RSA 2048
ssh-keygen -t rsa -b 4096 -C "<comment>" ##RSA 4096
Change filename and directory if needed
~/.ssh/id_xxx
Add following content to ~/.ssh/config
file
Host <hostname>
Hostname gitlab.com
User git
IdentityFile ~/.ssh/<id_name>
Add Identity
ssh-add ~/.ssh/<id_name>
ssh <host>
Verify that your SSH key was added correctly
ssh -T git@gitlab.example.com
Enter passphrase for key '/Users/<username>/.ssh/<id_name>':
PTY allocation request failed on channel 0
Welcome to GitLab, @username!
Connection to gitlab.com closed.
Use different keys for different repositories
git config core.sshCommand "ssh -o IdentitiesOnly=yes -i ~/.ssh/private-key-filename-for-this-repository -F /dev/null"
git #
Who am I #
git config user.name
git config user.email
Change username and email #
git config --global user.name "your_name"
git config --global user.email "email@example.com"
Initialization: git push from an existing folder #
cd existing_folder
git init
git remote add origin git@gitlab.com:username/reponame.git
git add .
git commit -m "Initial commit"
git push -u origin master
Daily Usage #
git pull
git add .
git commit -m "xxx commit"
git push