Public Envs

Dev Envs

ssh keygen

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
$ eval "$(ssh-agent -s)"
> Agent pid 59566
ssh-add -K ~/.ssh/id_rsa

Python

# 临时使用
pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple package
# 设为默认:升级 pip 到最新的版本 (>=10.0.0) 后进行配置
pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple pip -U
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple

Node

  • n
  • nvm
Yarn
npm cache clean --force
yarn cache clean
Source
npm config get registry  
// 查看npm当前镜像源
npm config set registry https://registry.npm.taobao.org/  
// 设置npm镜像源为淘宝镜像
yarn config get registry  
// 查看yarn当前镜像源
yarn config set registry https://registry.npm.taobao.org/  
// 设置yarn镜像源为淘宝镜像

Python

  • virtual envs
生成requirements.txt文件
pip freeze > requirements.txt

安装requirements.txt依赖
pip install -r requirements.txt

Proxys

apt install shadowsocks-libev proxychains proxychains-ng privoxy
pip install shadowsocks

ss-local -c sslocal.json

/etc/shadowsocks/config.json
{
    "server":"my_server_ip",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"mypassword",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false,
    "workers": 1,
    "prefer_ipv6": false
}

/etc/proxychains4.conf
/etc/proxychains.conf
socks5 127.0.0.1 1080

 /etc/privoxy/config
 # 使用的 socks5 代理地址是 127.0.0.1:1080
forward-socks5  /   127.0.0.1:1080  .
# 暴露出来的 http 代理地址是 localhost:1081 (default 8118
listen-address  localhost:1081

sudo systemctl restart privoxy

export https_proxy=http://127.0.0.1:8118 http_proxy=http://127.0.0.1:8118 all_proxy=socks5://127.0.0.1:1080
unix
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891
export ALL_PROXY="socks5://127.0.0.1:7891"
apt
sudo apt -o Acquire::http::proxy="http://127.0.0.1:7890/"

sudo touch /etc/apt/apt.conf.d/proxy.conf
sudo vi /etc/apt/apt.conf.d/proxy.conf

Acquire {
  HTTP::proxy "http://127.0.0.1:7890";
  HTTPS::proxy "http://127.0.0.1:7890";
}

Acquire::http::Proxy "http://user:password@proxy.server:port/";
Acquire::https::Proxy "http://user:password@proxy.server:port/";
snap
sudo snap set system proxy.http="http://127.0.0.1:7890"
sudo snap set system proxy.https="http://127.0.0.1:7890"
win
set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890
set http_proxy=socks5://127.0.0.1:7891
set https_proxy=socks5://127.0.0.1:7891
# unset
set http_proxy=
set https_proxy=
git
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
git config --global http.proxy socks5://127.0.0.1:7891
git config --global https.proxy socks5://127.0.0.1:7891
git config --global --unset http.proxy
git config --global --unset https.proxy
npm
npm config set proxy http://127.0.0.1:7890

Soft

Visual Studio Code

Exts

  • GitLens
  • stylus
  • vetur
  • pylint
  • prettier-eslint

Front End Vue + Stylus

yarn add -D prettier eslint-config-prettier eslint-plugin-prettier
yarn add -D eslint eslint-plugin-react eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-import-resolver-webpack
.prettierc
{
  "singleQuote": true,
  "semi": true,
  "trailingComma": "es5"
}
.eslintrc
{
  "extends": ["airbnb", "prettier", "prettier/react"],
  "plugins": ["react", "prettier"],
  "rules": {
    "prettier/prettier": "error",
  }
}

lnmp

  • install nginx http://nginx.org/en/linux_packages.html
    • /usr/sbin/nginx
    • /etc/nginx/

php

before 18.04

apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.2
php -v
apt install mysql-server -y
mysql_secure_installation

mysql -uroot -p  #使用空密码进入控制台
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';  # your_password 修改为自己的密码

unity

mac
echo '#!/bin/bash
export HTTP_PROXY=http://127.0.0.1:890
export HTTPS_PROXY=http://127.0.0.1:7890
nohup "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub" &>/dev/null &' > launchUnityHub.command
chmod +x launchUnityHub.command
win
@echo off
set HTTP_PROXY=http://127.0.0.1:1080
set HTTPS_PROXY=http://127.0.0.1:1080
start "" "C:\Program Files\Unity Hub\Unity Hub.exe"

cheat

解除端口占用

lsof

lsof -i:8080:查看8080端口占用
lsof abc.txt:显示开启文件abc.txt的进程
lsof -c abc:显示abc进程现在打开的文件
lsof -c -p 1234:列出进程号为1234的进程所打开的文件
lsof -g gid:显示归属gid的进程情况
lsof +d /usr/local/:显示目录下被进程开启的文件
lsof +D /usr/local/:同上,但是会搜索目录下的目录,时间较长
lsof -d 4:显示使用fd为4的进程
lsof -i -U:显示所有打开的端口和UNIX domain文件
kill -9 PID

Revision #23
Created 2 years ago by Dimpurr Cheny
Updated 2 years ago by Dimpurr Cheny