速查

命令速查

adb

  • 安装
    1
    adb -s device-name install demo.apk
  • 获取手机属性
    1
    adb -s device-name shell getprop
  • 获取手机model
    1
    2
    adb -s device-name shell getprop | grep product
    adb -s device-name shell getprop | grep ro.product.model
  • 设置代理
    1
    2
    adb shell settings put global http_proxy ip:port
    adb shell settings put global https_proxy ip:port
  • 清除代理
    1
    2
    adb shell settings put global http_proxy :0
    adb shell settings put global https_proxy :0
  • 不保留活动
    1
    2
    3
    4
    5
    6
    # 开启不保留活动
    adb shell settings put global always_finish_activities 1
    # 关闭不保留活动
    adb shell settings put global always_finish_activities 0
    # 查看不保留活动状态
    adb shell settings get global always_finish_activities
  • 推送文件至 data/data 目录
    1
    2
    3
    adb push a.txt /sdcard/
    // Android 10 及以下有效
    adb shell "run-as com.qq.e.union.demo.union sh -c 'cp /sdcard/a.txt /data/data/com.pkg/'"
  • 从 data/data 拉取文件
    1
    // TODO

ffmpeg

  • 转码
    1
    ffmpeg -i input.mp4 -profile:v baseline -level 3.0 output.mp4
  • 视频按帧转图片
    1
    ffmpeg -i input.mp4 -f image2 test/%05d.jpeg

ffprobe

  • 查看视频格式
    1
    ffprobe input.mp4 -show_streams -show_format -v quiet

gradle

  • 生成 gradlew
    1
    gradle wrapper
  • gradlew 修改版本
    1
    ./gradlew wrapper --gradle-version 7.2
  • gradlew 执行
    1
    ./gradlew :ModuleName:taskName

git

  • git 浅克隆
    1
    git clone -b branchName remote-url --single-branch
  • git clone 只clone一个分支,并且还能checkout远端分支
    1
    git clone --filter=blob:none --no-checkout remote-url
  • git 彻底删除 .gitignore 中文件
    1
    2
    git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch file.txt' --prune-empty --tag-name-filter cat -- --all
    git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch file_dir' --prune-empty --tag-name-filter cat -- --all
  • git 克隆项目到指定文件夹
    1
    git clone remote-url local-dir
  • git 显示中文
    1
    git config --global core.quotepath false
  • git remote
    1
    2
    3
    4
    5
    6
    # 添加remote
    git remote add upstream git@xxx:xxx/xxx.git
    # 不下载文件的fetch
    git fetch --filter=blob:none upstream
    # remote rename
    git remote rename remote1 remote2