朱争光

一点点攒起我的那片天

  • 主页
  • 文章分类
  • 标签
  • 我

朱争光

一点点攒起我的那片天

  • 主页
  • 文章分类
  • 标签
  • 我

nginx base auth

2016-04-20

##config
增加两行配置

1
2
3
4
location / {
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;
}

##生成htpasswd
生成一个用户名admin,密码admin的帐户

1
2
sudo sh -c "echo -n 'admin:'" >> htpasswd
sudo sh -c "openssl passwd admin" >> htpasswd

展开全文 >>

ghost 使用

2016-04-19

##增加搜索框
教程
http://academy.ghost.org/how-to-add-swiftype-search-to-your-ghost-blog/

##百度流量统计
http://sitecenter.baidu.com/sc-web/20271964/home/site/statrule?siteId=8656728

##加入图片
http://support.ghost.org/add-image-post/

展开全文 >>

科学上网

2016-04-17

 

完美讲解:

http://blog.panlin.me/posts/2015-07-19-digitalocean-shadowsocks-openvpn.html

--------------aws尝试后有时候比较慢,自行选择------------------------
aws日本的机器是可以开免费机器的。免费1年。
 日本上google还是嗖嗖的。。。

###aws注册账号,开免费主机

  1. 注册账号
    中文的。注册过程就免了吧?https://aws.amazon.com/cn/free/explain/

  2. 创建免费主机









    最后一步是下载你的sshkey。用于登陆用,下载后点击启动实例
    然后点击查看实例,可以看到ip

    然后通过ssh工具和下载的key登陆(别的工具类似)

1
2
chmod 400 ssh-key.pem
ssh -i ssh-key.pem ubuntu@ip

###在主机上部署代理shadowsocks

  1. 安装docker

    1
    curl -sSL https://get.daocloud.io/docker | sh
  2. 运行服务
    $SSPASSWORD 替换为你的密码,端口是59001(可自定义)

    1
    docker run -d -p 59001:1984 oddrationale/docker-shadowsocks -s 0.0.0.0 -p 1984 -k $SSPASSWORD -m aes-256-cfb

###客户端安装shadowsocks使用

客户端

  • mac:
    https://github.com/shadowsocks/shadowsocks-iOS/wiki/Shadowsocks-for-OSX-%E5%B8%AE%E5%8A%A9

  • windows:
    https://github.com/shadowsocks/shadowsocks-windows/wiki/Shadowsocks-Windows-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E

可以参考这个 http://www.ishadowsocks.net/
但服务器ip和端口,设置为你的服务器ip和端口
好啦,一年可以用了

展开全文 >>

SSL Error: CERT_UNTRUSTED while using npm command

2015-07-16

see :http://stackoverflow.com/questions/21855035/ssl-error-cert-untrusted-while-using-npm-command
I am trying to install express framework using npm command but getting following error.

error message is

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
30
E:\myFindings\nodejs_programs\node>npm install -g express
npm http GET https://registry.npmjs.org/express
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR! at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\main.js:409:26)
npm ERR! at ClientRequest.g (events.js:185:14)
npm ERR! at ClientRequest.EventEmitter.emit (events.js:88:17)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1445:7)
npm ERR! at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
npm ERR! at CleartextStream.socketOnData [as ondata] (http.js:1356:20)
npm ERR! at CleartextStream.CryptoStream._push (tls.js:396:27)
npm ERR! at SecurePair.cycle (tls.js:751:20)
npm ERR! at EncryptedStream.CryptoStream.write (tls.js:131:13)
npm ERR! at Socket.ondata (stream.js:38:26)
npm ERR! [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "express"
npm ERR! cwd E:\myFindings\nodejs_programs\node
npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32
npm ERR! message SSL Error: CERT_UNTRUSTED
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! E:\myFindings\nodejs_programs\node\npm-debug.log
npm ERR! not ok code 0
help me to sort out

You can bypass https using below commands:

1
npm config set strict-ssl false

or set the registry URL from https or http like below:

1
npm config set registry="http://registry.npmjs.org/"

However, Personally I believe bypassing https is not the real solution, but we can use it as a workaround.

展开全文 >>

nginx https

2015-07-13

https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-nginx-for-ubuntu-14-04

展开全文 >>

ubuntu vim 设置

2015-06-04

在终端下使用vim进行编辑时,默认情况下,编辑的界面上是没有显示行号、语法高亮度显示、智能缩进等功能的。为了更好的在vim下进行工作,需要手动设置一个配置文件:.vimrc。
在启动vim时,当前用户根目录下的.vimrc文件会被自动读取,该文件可以包含一些设置甚至脚本,所以,一般情况下把.vimrc文件创建在当前用户的根目录下比较方便,即创建的命令为:
$vi ~/.vimrc
设置完后
$:x 或者 $wq
进行保存退出即可。
下面给出一个例子,其中列出了经常用到的设置,详细的设置信息请参照参考资料:
“双引号开始的行为注释行,下同
“去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
set nocompatible  
“显示行号
set nummber
“检测文件的类型
filetype on
“记录历史的行数
set history=1000
“背景使用黑色
set background=dark
“语法高亮度显示
syntax on

“下面两行在进行编写代码时,在格式对起上很有用;
“第一行,vim使用自动对起,也就是把当前行的对起格式应用到下一行;
“第二行,依据上面的对起格式,智能的选择对起方式,对于类似C语言编
“写上很有用
set autoindent
set smartindent
“第一行设置tab键为4个空格,第二行设置当行之间交错时使用4个空格
set tabstop=4
set shiftwidth=4
“设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号
set showmatch
“去除vim的GUI版本中的toolbar
set guioptions-=T
“当vim进行编辑时,如果命令错误,会发出一个响声,该设置去掉响声
set vb t_vb=
“在编辑过程中,在右下角显示光标位置的状态行
set ruler
“默认情况下,寻找匹配是高亮度显示的,该设置关闭高亮显示
set nohls
“查询时非常方便,如要查找book单词,当输入到/b时,会自动找到第一
“个b开头的单词,当输入到/bo时,会自动找到第一个bo开头的单词,依
“次类推,进行查找时,使用此设置会快速找到答案,当你找要匹配的单词
“时,别忘记回车
set incsearch
“修改一个文件后,自动进行备份,备份的文件名为原文件名加“~“后缀
if has(“vms”)
set nobackup
else
set backup
endif

如果去除注释后,一个完整的.vimrc配置信息如下所示:

set nocompatible
set nummber
filetype on
set history=1000
set background=dark
syntax on
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set guioptions-=T
set vb t_vb=
set ruler
set nohls
set incsearch
if has(“vms”)
set nobackup
else
set backup
endif


如果设置完后,发现功能没有起作用,检查一下系统下是否安装了vim-enhanced包,查询命令为:
$rpm –q vim-enhanced

参考资料:

  1. vim的完全翻译版在下面连接处可以找到
    http://vimcdoc.sourceforge.net/
    可以下栽其中的一个PDF版本,里面介绍的很详细,强烈推荐:)
  2. 更详细的vim信息可以访问:
    http://www.vim.org/
  3. 一个带有英文注释的.vimrc例子
    http://www.vi-improved.org/vimrc.php
  • ubuntu vim, vim设置, vim

展开全文 >>

Welcome to Ghost

2015-06-03

You’re live! Nice. We’ve put together a little post to introduce you to the Ghost editor and get you started. You can manage your content by signing in to the admin area at <your blog URL>/ghost/. When you arrive, you can select this post from a list on the left and see a preview of it on the right. Click the little pencil icon at the top of the preview to edit this post and read the next section!

Getting Started

Ghost uses something called Markdown for writing. Essentially, it’s a shorthand way to manage your post formatting as you write!

Writing in Markdown is really easy. In the left hand panel of Ghost, you simply write as you normally would. Where appropriate, you can use shortcuts to style your content. For example, a list:

  • Item number one
  • Item number two
    • A nested item
  • A final item

or with numbers!

  1. Remember to buy some milk
  2. Drink the milk
  3. Tweet that I remembered to buy the milk, and drank it

Links

Want to link to a source? No problem. If you paste in a URL, like http://ghost.org - it’ll automatically be linked up. But if you want to customise your anchor text, you can do that too! Here’s a link to the Ghost website. Neat.

What about Images?

Images work too! Already know the URL of the image you want to include in your article? Simply paste it in like this to make it show up:

The Ghost Logo

Not sure which image you want to use yet? That’s ok too. Leave yourself a descriptive placeholder and keep writing. Come back later and drag and drop the image in to upload:

![A bowl of bananas]

Quoting

Sometimes a link isn’t enough, you want to quote someone on what they’ve said. It was probably very wisdomous. Is wisdomous a word? Find out in a future release when we introduce spellcheck! For now - it’s definitely a word.

Wisdomous - it’s definitely a word.

Working with Code

Got a streak of geek? We’ve got you covered there, too. You can write inline <code> blocks really easily with back ticks. Want to show off something more comprehensive? 4 spaces of indentation gets you there.

.awesome-thing {
    display: block;
    width: 100%;
}

Ready for a Break?

Throw 3 or more dashes down on any new line and you’ve got yourself a fancy new divider. Aw yeah.


Advanced Usage

There’s one fantastic secret about Markdown. If you want, you can write plain old HTML and it’ll still work! Very flexible.

That should be enough to get you started. Have fun - and let us know what you think :)

  • Getting Started

展开全文 >>

eclipse设置的断点无效的解决方案

2015-04-30

如果你是英文版的,那么可以通过Run——Skip All Breakpoints来搞定,就是取消你“跳过所有断点”的设置。
为什么会这样,很可能是哪次你手太快太慌,点错了。

http://huangqiqing123.iteye.com/blog/1583435

展开全文 >>

ubuntu top mem free

2015-04-28

每次看top都发现free 都很小,百度了下,说这个是未分配的值,不是内存剩余,不用担心。迷迷糊糊,后台再查吧

展开全文 >>

ngrok 后台运行

2015-04-24

ngrok的安装使用就不说了,官网上的很简单,也可以百度下

关于让他后台运行谷歌了半天,找到了个不错的解决方法

启动的时候这样启动

1
./ngrok -log=stdout > ngrok.log start  test1 test2 &

我的.ngrok 文件

1
2
3
4
5
6
7
8
9
10
tunnels:
test1:
proto:
http: 80
config:
proto:
http: 4040
test2:
proto:
tcp: 22

https://github.com/inconshreveable/ngrok/issues/57

展开全文 >>

« Prev12345Next »
豫ICP备17013970号-1 | Copyright © daozzg.com 保留所有权利。2019 朱争光