liuliaixue

当白云悠然褪去我已等不及登上高山仰望西方的天空但最美的不是夕阳是夜色如水月色流离


  • 首页

  • 归档

  • 标签

docker postgres installation

发表于 2018-03-25

postgres

1
2
sudo docker pull postgres
sudo docker run --name postgres-{ContainerName} -e POSTGRES_PASSWORD=${PGPassword} -e POSTGRES_USER={Username} -p 5432:5432 -d postgres
1
2
3
4
5
6
7
8
# login
psql -U {Username} -h 127.0.0.1 -p 5432

# db interface
postgres=#

# change db
postgres=# \c DB_NAME

useful command

1
2
3
4
5
sudo docker run --name postgres-tim -e POSTGRES_USER=timqian -p 5432:5432 -d postgres
psql -f ./tools/initDB.sql
select * from model_prop_log;

psql -U timqian -h 127.0.0.1 -p 5432 [-f initDB]

Docker:how to build image

发表于 2018-03-25

files

hello-world/
├── Dockerfile
├── index.js
├── package.json

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FROM node:8-alpine

# Create app directory
WORKDIR /home/hello-world

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm install --only=production

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ "npm", "start" ]

ref:https://nodejs.org/en/docs/guides/nodejs-docker-webapp/

index.js

server.js

build

1
sudo docker build -t liuliaixue/nodejs-hello-world .

mysql

发表于 2018-03-25

mysql

1
2
3
4
5
6
7
8
9
10
# sudo docker pull mysql
$ sudo docker pull mysql:5.6

$ sudo docker run -p 3306:3306 --name mymysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
$ sudo docker images

$ mysql -h127.0.0.1 -p3306 -uroot -p123456

$ sudo docker stop {container-id }
$ sudo docker rm {container-id }
1
2
3
4
5
sudo apt-get install mysql-client-core-5.7 


# sudo apt-get remove --purge mysql-client-core-5.7
# sudo apt-get autoremove --purge mysql-client-core-5.7

Hello World

发表于 2018-03-25

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

ansible-vault

发表于 2018-03-01
1
2
3
4
5
6
7
8
9
10
11
12
13
# create a new file
$ vim account
# write some word in account, such as 'xx@xx.com:mypass'
# save


$ ansible-vault encrypt account
# input password

$cat account
# encrypted string

$ ansible-vault decrypt account

Ubuntu中,如何删除编译安装的node?

发表于 2017-09-18

Ubuntu中,如何删除编译安装的node?

1 not good for all

1
sudo apt-get remove nodejs

2 the best

1
2
3
cd _the_path_you_install_node
sudo make uninstall
# ref: https://hungred.com/how-to/completely-removing-nodejs-npm/

3 not suggest

delete the path you installed node directly

1
2
which node
rm _the_path

node require需要注意的缓存问题

发表于 2017-09-18

require 会优先从cache中读取文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* add.js*/
let value = 0;
module.exports = () => {
console.log(value ++);
};



/* main.js*/
add_1 = require('./add.js');
add = require('./add.js');
add_1(); //1
add_1(); //2
add(); //3

Object.keys(require.cache).forEach(key => console.log(require.cache[key].exports === add););
//true

git log

发表于 2017-09-11

git tree

新建git tree命令来显示commit 树状图

1
git config --global alias.tree "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

如果已经命名会提示加上 –replace-all

1
git config --replace-all --global alias.tree "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

git revert

发表于 2017-09-11

#

比如当我们Git revert的时候,

git revert

Git会抱怨:

is a merge but no -m option was given

这是因为你revert的那个commit是一个merge commit,它有两个parent, Git不知道base是选哪个parent,就没法diff,所以就抱怨了,所以你要显示告诉Git用哪一个parent。

git revert sidsad8 -m 1

这样就选parent 1,那么parent 1又是哪一个呢?

一般来说,如果你在master上mergezhc_branch,那么parent 1就是master,parent 2就是zhc_branch.

Often this will be parent number one, for example if you were on master and did git merge unwanted and then decided to revert the merge of unwanted. The first parent would be your pre-merge master branch and the second parent would be the tip of unwanted.

上一篇:三分钟教你学Git(十九) - 全局,用户,仓库作用域的配置文件

原文:http://blog.csdn.net/hongchangfirst/article/details/49472913

作者:hongchangfirst

hongchangfirst的主页:http://blog.csdn.net/hongchangfirst

git rebase

发表于 2017-09-11

git rebase

git rebase 是用来合并分支的。会把当前分支的提交作为补丁,一个一个应用在作为base的分支上面。
如果有冲突,需要解决冲突然后重新提交,然后

1
2
git add _file
git rebase --contune

比如

1
2
3
4
5
6
7
8
9
10
11
12
13
14
git checkout master
git add master1.txt
git commit -a -m 'commit master1.txt'

git checkout rebase
git add rebase1.txt
git commit -a -m 'commit rebase1.txt'

git checkout master
git add master2.txt
git commit -a -m 'commit master2.txt'

git checkout rebase
git rebase master

结果是自动合并,并回到 branch rebase,注意commit的顺序,rebase上的commit都在master的后面

1
2
3
4
5
//git log

commit rebase1.txt
commit master2.txt
commit master1.txt

1…3456
Alan

Alan

55 日志
92 标签
© 2019 Alan
由 Hexo 强力驱动
主题 - NexT.Muse