常用命令(自用)

0.高頻命令

//創(chuàng)建環(huán)境
conda create -n test python=3.10
//切換環(huán)境
conda activate test
//環(huán)境列表
conda env list

//修改權(quán)限
chmod u+x *.sh

//淘寶鏡像
npm config set registry http://registry.npm.taobao.org
//阿里云鏡像
npm config set registry http://registry.npmmirror.com
//還原鏡像地址
npm config set registry https://registry.npmjs.org/

//python pip 設(shè)置阿里云鏡像
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

//.npmrc
registry=https://registry.npmmirror.com
electron_mirror=https://npmmirror.com/mirrors/electron/
electron_custom_dir={{ version }}
//.npmrc 華為源
registry=https://mirrors.huaweicloud.com/repository/npm/
electron_mirror=https://mirrors.huaweicloud.com/electron/
electron_custom_dir={{ version }}

//git代理
git config --global --list
git config --global --add http.proxy http://127.0.0.1:7897
git config --global --add https.proxy https://127.0.0.1:7897

git config --global --unset http.proxy http://127.0.0.1:7897
git config --global --unset https.proxy https://127.0.0.1:7897

//git移除對(duì)某個(gè)文件或文件夾的版本控制
git rm -r --cached ".idea"

//windows 開機(jī)自啟路徑
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

//PowerShell->運(yùn)行invoke-webrequest報(bào)錯(cuò):
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
[Net.ServicePointManager]::SecurityProtocol

//windows輸出彩色字體(ANSI轉(zhuǎn)義序列)亂碼:
Win+R,輸入regedit->"HKEY_CURRENT_USER\Console"->新建,DWORD(32位),命名: VirtualTerminalLevel,值為:1

//1.下載 NVM for Windows:
https://github.com/coreybutler/nvm-windows/releases
//2.列出所有可用的 Node.js 版本:
https://nodejs.org/en/about/previous-releases
nvm list available
//安裝node
nvm install 18.5.0
//查看安裝版本
nvm list
//切換版本
nvm use 18.5.0
//設(shè)置默認(rèn)
nvm use 20.18.1
//卸載
nvm uninstall 18.5.0 

//pkg支持最高node版本 18.5.0
npm install -g pkg
pkg index.js
pkg my-app.js --target win

#gradle下載慢替換
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.7-bin.zip

1.mac命令

//安裝redis
brew install redis
//查看安裝路徑
brew info redis
//允許任何主機(jī)連接、訪問
bind 127.0.0.1 改為 bind 0.0.0.0
//關(guān)閉保護(hù)模式
protected-mode yes 改為 protected-mode no
//設(shè)置密碼
requirepass 123456
//停止redis
brew services stop redis
//啟動(dòng)redis
brew services start redis
//測試遠(yuǎn)程訪問
redis-cli -h 192.168.1.2  -p 6379 -a 123456
//查看使用情況
info

//mac 啟動(dòng)redis
/usr/local/bin/redis-server
//mac 搜索文件快捷鍵
shift+command+G

2.adb 命令

//windows查看最上層成activity名字
adb shell dumpsys activity | findstr "ResumedActivity"

//端口映射
adb forward tcp:36668 tcp:36668
//多設(shè)備選擇
adb devices
adb -s  設(shè)備名  forward tcp:36668 tcp:36668

//小米手機(jī)無線調(diào)試,使用配對(duì)碼配對(duì)設(shè)備
adb pair 192.168.2.27:38323 //輸入6位驗(yàn)證碼
adb connect 192.168.2.27:38323 //鏈接
或者
adb tcpip 5555
adb connect 192.168.88.33:5555

//滑動(dòng)
adb shell input swipe 940 580 940 590 800
//點(diǎn)擊
adb shell input tap 650 800 500
//截屏
adb exec-out screencap -p > screenshot.png

//bat 循環(huán) 100次
for /l %%i in (1,1,100) do (
    echo %%i
)
//bat 循環(huán) 延時(shí)2s
timeout /t 2

3. 查看關(guān)閉端口

//mac查看端口:
sudo lsof -i :8080
//mac殺死端口(6228需要換成具體 kid):
sudo kill -9 6228 

//windows查看端口:
netstat -ano | findstr 8080
//windows殺死端口(6228需要換成具體 kid):
taskkill /F /pid 9544

//windows
echo 獲取管理員權(quán)限...
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit

echo 延時(shí)
timeout /t 180

echo 正在關(guān)閉ToDesk服務(wù)和進(jìn)程...
net stop "ToDesk Service"
taskkill /f /t /im ToDesk.exe

rem 切換到utf-8編碼,解決中文亂碼
chcp 65001
rem 切換目錄
cd %~d0
rem 無窗口啟動(dòng)
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("%~nx0"^&" h",0)^&(window.close) && exit
:begin
start "" cmd /c start.cmd

4.Idea setget方法無法識(shí)別,添加lombok插件

5.接口請(qǐng)求案列

RetrofitUtils.getInfoByKey("tribe_info")
                    .subscribeOn(Schedulers.io())
                    .observeOn(Schedulers.io())
//                    .flatMap((Function<List<MyInfoBean>, ObservableSource<List<MyInfoBean>>>) infoBeans -> {
//                    if (infoBeans.size() > 0) {
//                        return RetrofitUtils.getInfoByKey("tribe_info");
//                    }
//                        return Observable.error(new NullObservableSourceException());
//                    })
//                    .subscribeOn(Schedulers.io())
//                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(new MyObserver<List<MyInfoBean>>() {
                        @Override
                        protected void onSuccess(List<MyInfoBean> item) {
                            LogUtils.i(JSONObject.toJSONString(item));
                        }

                        @Override
                        protected void onError(int code, String message) {
                            ToastUtils.showShort(message);
                        }
                    });
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Docker使用了Linux的namespace技術(shù)來進(jìn)行資源隔離,如PID Namespace隔離進(jìn)程,Moun...
    硅谷干貨閱讀 219評(píng)論 0 1
  • 1、首先需要安裝好git,這個(gè)百度就搞定了 2、進(jìn)入到需要git管理代碼的路徑 3、開始git命令 到達(dá)指定路徑之...
    哥不論墨夏倫閱讀 313評(píng)論 0 0
  • 不同操作系統(tǒng)關(guān)鍵字: 版權(quán)聲明:本文為CSDN博主「熱愛學(xué)習(xí)的吉吉」的原創(chuàng)文章,原文鏈接:https://blog...
    呵呵豆閱讀 2,898評(píng)論 0 0
  • 引言 本文為小編學(xué)習(xí)總結(jié)的一些adb的常用命令,可能一些命令有待驗(yàn)證,更多內(nèi)容可以參考adb用法大全[https:...
    搬碼人閱讀 7,564評(píng)論 3 38
  • ADB簡介: ADB,即 Android Debug Bridge,它是 Android 開發(fā)/測試人員不可替代的...
    山野過客閱讀 464評(píng)論 0 0

友情鏈接更多精彩內(nèi)容