景灵

——我要我想要的


  • 首页

  • 分类

  • 归档

  • 标签

  • 关于

安装pythod-virtualenv

发表于 Aug 3 2016   |   分类于 python , 整理

Centos6.5环境安装pythod-virtualenv时,yum安装失败:

1
$ yum install python-virtualenv

错误提示:

1
2
3
4
5
6
7
8
9
$ yum install python-virtualenv
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
Setting up Install Process
No package python-virtualenv available.
Error: Nothing to do

没有找到此问题的具体原因和解决方案,所以只能更换virtualenv的安装方式。

阅读全文 »

node服务器不响应--mysql连接(整理)

发表于 Aug 3 2016   |   分类于 mysql , 整理

  使用node.js搭建的服务器,发现使用一段时间后就不响应了,找了好久也没发现有啥问题,只能无奈的重启。

  某一天看到了在Node.js使用mysql模块时遇到的坑 这篇文章。仔细想想确实也只有在mysql这里出问题了,因为以前一直使用的是mongodb,没遇见过这个问题。

  于是,开始在网上找各种关于mysql连接自动释放的文章,结果都是很早以前的文章。

  我只能从数据库入手,

阅读全文 »

fetch跨域使用

发表于 Aug 3 2016   |   分类于 整理 , http

  fetch在发送跨域请求的时候默认是不带cookie的,此时服务器也不能通过“set-cookie”让浏览器生成cookie。

  可以通过设置credentials为include来解决这个问题。

传统 Ajax 已死,Fetch 永生: https://github.com/camsong/blog/issues/2

消息系统设计与实现(整理)

发表于 Aug 2 2016   |   分类于 原理 , 整理

消息系统设计与实现:http://www.jianshu.com/p/f4d7827821f1

重设密码--邮箱重设(整理)

发表于 Aug 2 2016   |   分类于 原理 , 整理
业务

  用户忘记密码了,通过输入之前注册的邮件,我们向用户的邮箱发一个链接以重设密码。

用户流程:
  1. 用户忘记密码,来到密码重设界面
  2. 用户输入Email地址(可以在发邮件之前先验证邮箱是否注册),点击重设密码按钮
  3. 用户收到一封密码重设邮件,里面有重设密码的链接,此链接有过期时间
  4. 用户点击链接,来到密码重设页面,输入新密码,完成
    这个流程并没有什么创新,很多网站都是用这套流程
阅读全文 »

Letsencrypt安装、使用教程

发表于 Jan 15 2016
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[root@server45 letsencrypt]# ./letsencrypt-auto certonly --standalone --email admin@thing.com -d thing.com -d www.thing.com
Bootstrapping dependencies for RedHat-based OSes...
yum is /usr/bin/yum
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
Setting up Install Process
Package python-2.6.6-64.el6.x86_64 already installed and latest version
Package python-devel-2.6.6-64.el6.x86_64 already installed and latest version
No package python-virtualenv available.
Nothing to do
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
Setting up Install Process
Package gcc-4.4.7-16.el6.x86_64 already installed and latest version
Package dialog-1.1-9.20080819.1.el6.x86_64 already installed and latest version
Package augeas-libs-1.0.0-10.el6.x86_64 already installed and latest version
Package openssl-devel-1.0.1e-42.el6_7.2.x86_64 already installed and latest version
Package libffi-devel-3.0.5-3.2.el6.x86_64 already installed and latest version
Package redhat-rpm-config-9.0.3-44.el6.centos.noarch already installed and latest version
Package ca-certificates-2015.2.4-65.0.1.el6_6.noarch already installed and latest version
Nothing to do
Creating virtual environment...
./letsencrypt-auto: line 167: virtualenv: command not found

安装letsencrypt-nginx

1
$ /root/.local/share/letsencrypt/bin/pip install -U letsencrypt-nginx

修改hostname

发表于 Jan 15 2016   |   分类于 linux

Linux操作系统的hostname是一个kernel变量,可以通过以下方式查询。

  1. 可以通过hostname命令来查看本机的hostname。

    1
    $ hostname
  2. 也可以直接cat /proc/sys/kernel/hostname查看.

    1
    $ cat /proc/sys/kernel/hostname
  3. 也可以用uname -n查看

    1
    $ uname -n

1. 修改运行时(即不需要重启系统)Linux系统的hostname

1
$ hostname newname

运行后立即生效,但是在系统重启后会丢失所做的修改,如果要永久更改系统的hostname,就要修改相关的设置文件.

2. 永久更改Linux的hostname:
通过配置文件/etc/sysconfig/network修改

1
2
3
4
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain #修改这里的HOSTNAME

修改后

1
2
3
4
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=serverXXX #修改这里的HOSTNAME

  通过修改此文件的内容,它能够实现永久修改linux的主机名,但是它不会立即生效,即有可能不在当前运行时间生效,即在从下次重启后才开始生效,至少是 不在当前session生效,需要用户退出以后才生效。通过修改此配置文件,再配合hostname命令,可实现立即永久修改linux的主机名。

ssh免密码登录

发表于 Jan 15 2016   |   分类于 linux

A免密码登录B

  1. 在A上生成一对key(如果已经有,就直接进行2.)

    1
    $ ssh-keygen -t rsa -P ''
  2. 把公钥添加到B(root@105.251.224.47)

    1
    $ ssh-copy-id root@105.251.224.47

注:mac下可能没有安装ssh-copy-id,可以用下面的方式安装

1
$ brew install ssh-copy-id

升级Python到2.7

发表于 Jan 15 2016

升级Python,只需要简单的几步:

  1. 查看系统当前python版本

    1
    2
    3
    [root@localhost ~]# python -V
    Python 2.6.6
    [root@localhost ~]#
  2. 下载新版本的python2.7

    1
    [root@localhost ~]# wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
阅读全文 »

Browserify参数解析

发表于 Jan 6 2016   |   分类于 构建

Browserify命令行参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--outfile, -o Write the browserify bundle to this file.
If unspecified, browserify prints to stdout.
--require, -r A module name or file to bundle.require()
Optionally use a colon separator to set the target.
--entry, -e An entry point of your app
--ignore, -i Omit a file from the output bundle.
--external, -x Reference a file from another bundle.
--transform, -t Use a transform module on top-level files.
--command, -c Use a transform command on top-level files.
--standalone -s Generate a UMD bundle for the supplied export name.
This bundle works with other module systems and sets the name
given as a window global if no module system is found.
--debug -d Enable source maps that allow you to debug your files separately.
--help, -h Show this message
For advanced options, type `browserify --help advanced`.
  • –outfile, -o: browserify日志打印到文件
  • –require, -r: 绑定模块名或文件,用逗号分隔
  • –entry, -e: 应用程序的入口
    阅读全文 »
123…8
crazyjingling

crazyjingling

crazyjingling's blog | Node.js | javascript

75 日志
60 分类
106 标签
github twitter weibo zhihu
© 2016 crazyjingling
由 Hexo 强力驱动
主题 - NexT.Mist