linux显示中文

查看字符编码 locale 修改字符编码 dpkg-reconfigure locales Debian and Ubuntu /etc/default/locale ssh输入中文 修改 /etc/default/locale LANG=C.UTF-8 LANGUAGE= LC_CTYPE=C.UTF-8 LC_NUMERIC="C.UTF-8" LC_TIME="C.UTF-8" LC_COLLATE="C.UTF-8" LC_MONETARY="C.UTF-8" LC_MESSAGES="C.UTF-8" LC_PAPER="C.UTF-8" LC_NAME="C.UTF-8" LC_ADDRESS="C.UTF-8" LC_TELEPHONE="C.UTF-8" LC_MEASUREMENT="C.UTF-8" LC_IDENTIFICATION="C.UTF-8" LC_ALL= 本地访问远程终端,本地的locale和远程的locale中的变量相同可以避免乱码 ……

阅读全文

使用PEM文件ssh

连接服务器 sudo chmod 600 key.pem ssh -i key.pem username@ip ssh-add key.pem ssh-add -l #显示密钥 sudo ssh-add -D #删除所有密钥 ……

阅读全文

jupyter使用xgboost服务挂掉

发生错误 OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized. 1 import os os.environ['KMP_DUPLICATE_LIB_OK']='True' 2 安装nomkl conda install nomkl 参考https://github.com/dmlc/xgboost/issues/1715……

阅读全文

使用postgresql

sudo apt-get install postgresql netstat -ap | grep 5432 切换用户并登录 sudo su postgres psql postgres 创建用户 CREATE USER username WITH PASSWORD 'password'; 创建数据库 和 赋权 \c databasename #切换数据库 CREATE DATABASE databasename OWNER username; GRANT ALL PRIVILEGES ON DATABASE databasename TO username; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO username; 退出 \q 登录 psql -U username -d databasename -h 127.0.0.1 -p 5432 设置远程访问 postgresql.conf 配置文件路径 /etc/postgresql/{{version}}/main/postgresql.conf listen_addresses = 'localhost' 修改成 '*' pg_hba.……

阅读全文

使用git

git --version #查看版本 生成密钥 ssh-keygen -t rsa -f ~/.ssh/id_rsa_github -C "[email protected]" #生成文件 ls ~/.ssh/ id_rsa_github id_rsa_github.pub known_hosts 添加公钥到github id_rsa_github.pub内容复制到github上 #测试 ssh -i ~/.ssh/id_rsa_github -T git@github .com ssh -T [email protected] #会报错,需要配置config 新建config Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa_github 测试 ssh -T [email protected] 单独到项目文件夹设置用户名邮箱 git config user.email “[email protected]” git config user.name “username” 常用命令 git add . git commit -m "message" git push git status git diff git config --local --list 回滚 git revert ID……

阅读全文

nestjs相关

nestjs nodemon 新建 nest new nesttest src/ ├── app.controller.spec.ts ├── app.controller.ts ├── app.module.ts ├── app.service.ts └── main.ts 运行 npm run start main.ts中 app.listen({{port}) 端口号 默认3000 访问localhost:3000 生成控制器 nest generate controller cats https://docs.nestjs.com/controllers 返回的时候使用的引号` ,使用' 不能显示变量 生成服务 nest generate service cats //cats.service.ts @Injectable() export class CatsService { private readonly cats: Cat[] = []; create(cat: Cat){ this.cats.push(cat) } findAll(): Cat[] { return this.cats; } } //cats.controller.ts @Controller('cats') export class CatsController { constructor(private readonly catsService: CatsService) {} @Get() async findAll(): Promise<Cat[]> { return this.……

阅读全文

使用ibmcloud

创建资源 安装使用 IBM Cloud CLI https://console.bluemix.net/docs/cli/index.html#overview ibmcloud api https://api.ng.bluemix.net ibmcloud login -u [email protected] -o [email protected] -s dev //上传 bluemix app push pythondjangotest 创建项目 django-admin startproject mysite cd mysite //上传程序要在这个目录执行上传命令 python3 manage.py startapp helloworld 解决依赖 pip3 freeze > requirements.txt chardet==2.3.0 Django==2.1.7 gunicorn==19.9.0 httplib2==0.9.2 pycurl==7.43.0 pytz==2018.9 reportbug==7.1.7 requests==2.12.4 six==1.10.0 urllib3==1.19.1 uWSGI==2.0.18 在目录下新建runtime.txt,并添加python版本 例如: python-3.6.4 遇到错误 bluemix cf set-env pythondjangotest DISABLE_COLLECTSTATIC 1 bluemix cf restage pythondjangotest Procfile文件 web: gunicorn mysite.wsgi bluemix app push pythondjangotest 各种问题 python3……

阅读全文

angular相关

https://angular.io 安装 npm install -g @angular/cli 新建项目 ng new my-app https://angular.io/guide/entry-components The entryComponents array Though these two mechanisms account for most entry components, if your app happens to bootstrap or dynamically load a component by type imperatively, you must add it to entryComponents explicitly. 传递变量到dialog https://material.angular.io/components/dialog/overview ngClass用法 https://angular.io/api/common/NgClass 下拉列表默认值 https://stackblitz.com/edit/how-to-set-default-value-of-mat-select-when-options-are-retriev?file=app%2Ftable-basic-example.html……

阅读全文

rust相关

安装 https://www.rust-lang.org/learn/get-started curl https://sh.rustup.rs -sSf | sh rustc --version rustc 1.32.0 (9fda7c223 2019-01-16) 尝试hello world mkdir hello_world cd hello_world 创建main.rs fn main() { println!("Hello, world!") } 编译并运行 rustc main.rs ./main Hello, world! 使用cargo cargo --version cargo 1.32.0 (8610973aa 2019-01-02) cargo new hello-rust tree ├── hello-rust │ ├── Cargo.toml │ └── src │ └── main.rs 编辑main.rs 编译并运行 cargo build cargo run ……

阅读全文

线性回归

Linear Regression_Intro page 10 生成数据 NumberObservations=100 minVal=1 maxVal=20 X = np.random.uniform(minVal,maxVal,(NumberObservations,1)) print(X.shape) #Add you code below to define error and Y based on the information above def generateY(x): Y = np.array(100) Y = 10 + 5*x #print(Y) gaussian_noise = np.random.normal(0, 1, 100).reshape(100,1) #print(gaussian_noise) Y = Y + gaussian_noise return Y Y = generateY(X) print(Y) 线性回归 def calculate_RSS(B0, B1, testX, testY): testX = np.array(testX) testY = np.array(testY) predictY = testX*B1+B0 RSS = sum((testY-predictY)*(testY-predictY)) return RSS def linear_regression(B0, B1, trainX, trainY, iteration=10000, learning_rate=0.……

阅读全文