Published on

bash test

Authors
  • avatar
    Name
    minnie
    Twitter

Introduction

bash demo

yt-dlp

yt-dlp -ciw "+res:1080,br" --merge-output-format mp4 

yt-dlp -ciw --cookies cookies.txt --cookies-from-browser chrome

yt-dlp -ciw --playlist-items x-y URL 

yt-dlp -ciw -x --audio-format mp3 URL

yt-dlp -ciw --download-archive FILE  

yt-dlp -ciw --write-subs --sub-langs "en,zh" LINK



mac shell demo:

#!/bin/bash
yt-dlp -ciw -f 'bestvideo[height=1080]+bestaudio/bestvideo+bestaudio' --merge-output-format mp4 $1

win bat demo: 

@echo off
set a=
set/p a= paste link:
start yt-dlp -ciw -f 'bestvideo[height=1080]+bestaudio/bestvideo+bestaudio' --merge-output-format mp4 %a%

bilix

bilix $1 $2 --subtitle --dm --image

BBDown

BBDown --audio-only URL
BBDown --skip-ai false URL
BBDown -dd URL
BBDown -e "hevc" -q "720P 高清" -p ALL  URL 
BBDown -F <videoTitle>-<bvid> --save-archives-to-file URL 

homebrew

brew cask install visual-studio-code  picgo  telegram postman docker the-unarchiver anki  iina webstorm pycharm feem  google-chrome downie

brew install nodejs npm ffmpeg 

pip

pip install requests beautifulsoup4 selenium scripy chromedriver

choco

choco install git nodejs  aria2 greenshot ffmpeg  7zip postman potplayer bitvise-ssh-client vscode winscp pycharm webstorm docker mysql picgo   -y

launch aria2 on macos

nohup aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all &

ffmpeg

# win

copy:

@echo off
mkdir newfiles
for %%a in ("*.flv") do ffmpeg -i "%%a"  -codec copy -y "newfiles\%%~na.mp4"
pause

trans:

for %%a in ("*.mp4") do ffmpeg -i "%%a" -vcodec h264_qsv -crf 22 -c:a copy  "newfiles\%%~na.mp4"

toMp3:

ffmpeg -i input.mp4 -vn output.aac
ffmpeg -i input.aac -acodec libmp3lame -ab 320k output.mp3

# mac

copy:

for loop in *.flv ; ffmpeg -i "$loop" -codec copy "newfile/${loop%.flv}.mp4"

trans:

ffmpeg -i $1 -c:v h264_videotoolbox $1.mp4

loop

links in file:

for link in $(cat ./down.txt); do  BBDown -e "hevc" -q "720P 高清" "$link"; done

match string start:
for file in web*.txt; do mv "$file" "${file#web}"; done

string split:
for url in $(cat chat_list.txt); do chat_downloader --cookies cookies.txt "$url" --output "${url: -11}.json" | tee -a "${url: -11}.txt"; done

mac安全性与隐私

sudo spctl --master-disable

csrutil disable

mac磁盘格式化

diskutil partitiondisk 盘名 JHFS+ newdisk 100% 

mac文件显示与隐藏

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

powershell此系统上禁止运行脚本

set-executionpolicy remotesigned

setnet

win:

netsh interface ip set address name="NET" source=static addr=192.168.11.143 mask=255.255.255.0 gateway=192.168.11.213
netsh interface ip set dns name="NET" source=static addr=192.168.11.213

mac:

networksetup -setmanual "Wi-Fi" 192.168.11.220 255.255.252.0 192.168.11.213; networksetup -setdnsservers Wi-Fi 192.168.11.213

backnet

win:

netsh interface ip set address name="NET" source=dhcp
netsh interface ip set dns name="NET" source=dhcp

mac:

networksetup -setdhcp "Wi-Fi"; networksetup -setdnsservers Wi-Fi 192.168.11.1

windows net reset

netsh winsock reset

front-demo

#!/bin/bash

cd 

cd ./projects

mkdir $1

cd $1

mkdir css;cd ./css;touch style.css

cd ..

mkdir js; cd ./js; touch src.js

cd ..

touch index.html

echo "<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/style.css">
</head>
<body>
    <script src="./js/src.js"></script>
</body>
</html>" > index.html 

code .

spider-demo

#!/bin/bash

cd 

cd ./projects

mkdir $1

cd $1

mkdir utils; cd ./utils; touch util.py; touch down.txt; touch demo.html 

cd ..

touch $2.py

echo "# coding:utf-8" > $2.py 

code .

activated

win:

irm https://get.activated.win | iex

idm:

irm massgrave.dev/ias | iex

linux-dd write disk

dd if=/tmp/upload/openwrt.img of=/dev/sda