- 工作 working Tips
- proxy setting
- curl 对某些 url 不使用代理
- pip 使用国内源
- pip upgrade all outdated package
- FileMerge
- Get Proxy Info
- lldb 调试 Segment Fault on MacOSX
- download youtube playlist : yt-dlp
- using ffmpeg to convert video to mp3 (未验证)
- use ffmpeg select left audio channel and downgrade to mono
- use ffmpeg manipulate audio channel
- merge subtile to video
- ab benchmark
- check wheter
keep-alive
is enabled by server - change .pem password
- tcpdump on OSX
- 获取外网ip
- MacOSX add Printer in Windows LAN
- Bash , exit or ret ?
- FTP Server
- [MacOSX] move large files out of system volumn
- [MacOSX] monitor files changes under current folder
- [MacOSX] chrome gpu acceleration not work
export _proxy=username:password@IP_or_DOMAIN:3128
export http_proxy=http://$_proxy
export https_proxy=http://$_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
#u3d proxy ?
export HTTP_proxy=$http_proxy
export HTTPS_proxy=$https_proxy
# export NO_PROXY=localhost,localhost.,127.0.0.1,10.96.0.0/12,10.244.0.0/16,10.192.0.0/16
export NO_PROXY="localhost,127.0.0.*,10.96.0.0/12,10.244.0.0/16,10.192.0.0/16"
export no_proxy=$NO_PROXY
curl -v --noproxy 127.0.0.1
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ...
pip list --outdated | cut -d' ' -f1 | xargs pip install --upgrade
opendiff file1 file2
or for entire directories
opendiff dir1 dir2
or
/Developer/Applications/FileMerge.app/Contents/MacOS/FileMerge -left “File1” -right "File2" -ancestor "File3" -merge "File4"
chrome: chrome://net-internals/#proxy
- 编译加上
+g
选项 ulimit -c unlimited
- /cores/core.xxx 文件生成
lldb appname core.15667
- 运行, crash后,输入
bt
打印跟踪堆栈
- install: deprecated !!!
brew install yt-dlp
- best installation
python3 -m pip install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz yt-dlp URL
yt-dlp --ignore-errors --rm-cache-dir -c --write-auto-sub --sub-lang=en -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' --cookies-from-browser chrome 'https://www.youtube.com/playlist?list=PLKUel_nHsTQ1yX7tQxR_SQRdcOFyXfNAb'
- 如果视频确定有 premade 字幕, 使用
--write-sub
- ensure you add
' '
to url since some special character may appears in URL has a special meaning in bash - other useful options
-c
means resume downloading--ignore-errors
忽略下载错误,比如 private vidoe--rm-cache-dir
避免403 错误
- start from specific entry from a list, e.g. from 20
--playlist-start 20
$ yt-dlp --write-auto-sub --skip-download --sub-lang=en ...
yt-dlp --ignore-errors --rm-cache-dir -x --audio-format mp3 'your-url'
To encode a high quality MP3 from an AVI best use -q:a for variable bit rate:
ffmpeg -i sample.avi -q:a 0 -map a sample.mp3
-af 'volume=2'
-q:a for variable bit rate:
# ffmpeg -i input -map_channel 0.0.0 output
ffmpeg -i xxx.m4a -map_channel 0.0.0 output.mp3
https://trac.ffmpeg.org/wiki/AudioChannelManipulation
change audio volume
# low 50% volume of left audio channel
-af "pan=stereo|c0=0.5*c0|c1=c1"
# mergeSubtile.sh
#!/bin/sh
set -e
INFILE=$1
SUBTITLES=$2
# if arguments are not passed, show usage and exit
if [ $# -ne 2 ]; then
echo "Usage: $0 <inputfile> <subtitlefile>"
exit 1
fi
echo $INFILE , $SUBTITLES
ffmpeg -i $SUBTITLES temp.ass && \
BITRATE=$(ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 $INFILE) && \
ffmpeg -i $INFILE -vf ass=temp.ass -vcodec h264_videotoolbox -b:v $BITRATE -c:a copy output_burnedin.mp4
ab -r -k -s 120 -n 100000 -c 1500 <url>
-
-s
timeout, default is 30sec -
-r
Don't exit on socket receive errors. -
-k
Use HTTP KeepAlive feature- caution: not work with nodejs. it is a bug of ab , since ab is a http 1.0 client. You should add extra
-H "TE: chunked"
- caution: not work with nodejs. it is a bug of ab , since ab is a http 1.0 client. You should add extra
-
Post Example
ab -r -k -s 120 -n 100000 -c 1500 \ -H 'accept: application/json' -H 'token: asdf' \ -T application/json -p body.json \ 'http://localhost:3000/user'
- the 2nd line is Arbitrary header
- the 3rd line,
-p
specify the post file,-T
specify content-type
curl -I <url>
mv config/private.pem config/private_old.pem
openssl rsa -in config/private_old.pem -out config/private.pem -des3
OR
ssh-keygen -p -m PEM -f <path-to-private-key>
curl ifconfig.co
- Advanced
- Type: Windows printer via spoolss
- URL:
smb://<printer's IP or domain name>/<printer name>
if you execute your bash script with source
, exit
command will stop the user shell.
to prevent it
[[ "$0" == "$BASH_SOURCE" ]] && ret=exit || ret=return
...
$ret 1
pip3 install pyftpdlib
python3 -m pyftpdlib -w -p 80
DockerRaw -> ~/Library/Containers/com.docker.docker/Data/vms/0/data
UnityLogs -> ~/Library/Logs/Unity
brew install watch
watch -n 1 -d find .
# to skie .git folder
watch -n 1 -d find . -path ./.git -prune -o -print
- delete chrome app
- delete
~/Library/Application Support/Google/Chrome
- reinstall chrome app
check chrome gpu acceleration status
chrome://gpu