Skip to content

Instantly share code, notes, and snippets.

View ytlm's full-sized avatar

Tinglong Yang ytlm

View GitHub Profile
@ytlm
ytlm / config
Last active July 30, 2018 06:10
expect自动ssh登陆,只需更新config然后记住ip就行了,或者批量scp,不需要记住密码。只需要更新config,面向linuxer
# ip port user password
# comments
@ytlm
ytlm / bash.md
Last active October 18, 2021 10:00
bash note

if

if [ condition1 ]; then
    expression1
elif [ condition2 ]; then
    expression2
else
    expression3
fi
@ytlm
ytlm / set
Last active January 31, 2023 22:20
关闭安卓chrome文章推荐,还原一个干净的浏览器体验
chrome://flags/#enable-ntp-popular-sites
chrome://flags/#enable-ntp-remote-suggestions
chrome://flags/#enable-ntp-asset-download-suggestions
chrome://flags/#enable-ntp-bookmark-suggestions
chrome://flags/#enable-ntp-snippet
@ytlm
ytlm / curl-format.txt
Created April 23, 2018 03:32
curl format for analysis request time consuming
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_redirect: %{time_redirect}\n
time_pretransfer: %{time_pretransfer}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
@ytlm
ytlm / docker.sh
Last active April 17, 2019 12:39
非root用户使用docker命令
sudo groupadd docker
sudo gpasswd -a ${USER} docker || sudo usermod -aG docker ${USER}
sudo systemctl restart docker
sudo chmod a+rw /var/run/docker.sock
# 退出当前用户重新进来,就可以用非root用户使用docker命令
@ytlm
ytlm / check.sh
Created July 31, 2018 01:02
check centos version
* hostnamectl
* rpm --query centos-release
* lsb_release -d
* cat /etc/centos-release
* cat /etc/os-release
* cat /etc/redhat-release
* cat /etc/system-release
@ytlm
ytlm / smb.conf
Last active June 13, 2022 07:59
samb 默认配置
[share]
comment = Share Files
path = /root
valid users = root
write list = root
writeable = yes
browsable = yes
@ytlm
ytlm / git.bash
Last active April 15, 2019 06:05
同步删除已经在远程被删除的本地分支
git fetch -p
git remote prune origin
# 删除所有已经merge到master上的分支
git branch --merged master | grep -v '^\*\| master' | xargs -n 1 git branch -d
# 查找所有远程分支不存在的本地分支,然后再用git branch -d进行删除
for b in $(git branch -vv | grep -v origin | awk '{print $1}'); do
@ytlm
ytlm / ffmpeg
Last active March 19, 2020 03:36
ffmpeg command record
ffmpeg -ss 00:00:03 -t 60s -i test.flv -c:v libx264 -c:a aac -strict experimental -b:a 98k out.mp4
# 从test.flv视频中的00:00:03时间点开始,截取60s时间的视频,输出为out.mp4视频文件
ffmpeg -i test.flv -strict -2 -vf crop=1920:1000:430:0 out.mp4
# 具体含义是 crop=width:height:x:y,其中 width 和 height 表示裁剪后的尺寸,x:y 表示裁剪区域的左上角坐标。将该点作为基准点,向右下进行裁剪得到输出视频。
ffmpeg -i test.flv -filter_complex transpose=1 -y out.mp4
# transpose=1为顺时针旋转90°,transpose=2逆时针旋转90°。
@ytlm
ytlm / http_header.js
Last active December 11, 2019 06:33
Pre-request Script for postman 技巧
// 生成http Date
var today = new Date()
var apiDate = today.toUTCString()
postman.setEnvironmentVariable("api-date", apiDate);
// 获取请求method
var method = request.method