Skip to content

Instantly share code, notes, and snippets.

@chensoren
chensoren / https.md
Created November 25, 2015 01:57
namecheap获取ssl cert并配置https

#####首先要激活在namecheap上购买的ssl服务

  1. 生成SSL证书获取CSR bash openssl req -new -key yourdomain.pem -out yourdomain.csr , 然后按照提示输入信息即可
  2. 执行cat yourdomain.csr 内容大概如下 ``` -----BEGIN CERTIFICATE REQUEST----- MIICxDCCAawCAQAwfzELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxEDAO BgNVBAcMB0JlaWppbmcxDjAMBgNVBAoMBUJpZ2ZhMRcwFQYDVQQDDA55b3VyZG9t YWluLmNvbTEjMCEGCSqGSIb3DQEJARYUYWRtaW5AeW91cmRvbWFpbi5jb20wggEi MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9fsxThwLzCd54s2GMUcjlleCj LTf9bYGQyIjn+6z7kJbDbcrkbZxMysfRnFLa6u5oK7S9PQfGHK/gZeHfSLXbD/GL wi171tZpnQHjfLjMbHEUEUCFQD7ueek/v3/Tr+T0+em1gQt/93K2dqv7Cx+bupwc zNkQmqNgqslC4sdKQZjLUIHYLr/j8lQQLOOn9/PiuNOGCTaK5g9TA20oVCjpJZuf
@chensoren
chensoren / firewall.sh
Created November 14, 2015 14:52
firewall config
# firewall
ufw allow ssh
ufw allow http
ufw allow https
ufw logging on
ufw enable
# check rule
ufw status numbered
@chensoren
chensoren / Disk.md
Last active November 12, 2015 13:04
Digitalocean上Debian系统删除垃圾文件后磁盘空间仍然占100%
@chensoren
chensoren / xargs.sh
Created April 18, 2015 09:42
xargs remove file with special name on mac
ls | grep 发货 | tr '\n' '\0' | xargs -0 rm
# -*- coding: utf-8 -*-
from scrapy.item import Item, Field
class RamenStyle(Item):
shop_id = Field()
style = Field()
soup = Field()
class RamenReview(Item):
review_id = Field()
@chensoren
chensoren / login_by_cookies.md
Created January 22, 2015 13:07
导入cookies文件实现自动登录

##Download chrome plugin cookietxt-export and export cookie data to cookie.txt after you login manually##

agent = Mechanize.new

agent.cookie_jar.load('cookies.txt', :cookiestxt)

@chensoren
chensoren / bundle_local.md
Last active January 6, 2018 06:49
在Gemfile里面利用bundle修复gem插件的bug

###方法1: 可以将远端的github代码下到本地来修改,无须再自己fork一个新的项目,便于快速修改plugin中的错误, 下面是使用方法

Bundler also allows you to work against a git repository locally instead of using the remote version. This can be achieved by setting up a local override:

bundle config local.GEM_NAME /path/to/local/git/repository (bundle config local.active_shipping ~/gems/active_shipping/)

and setup the git repo pointing to a branch: gem 'active_utils', :github => 'Shopify/active_utils', :branch => '2.2.3'

##推荐使用方法2, 将github的源码copy到vendor下,然后在gemfile里面指定一下path##

How to install PhantomJS on Ubuntu

Version: 1.9.7

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
@chensoren
chensoren / com.md
Last active August 29, 2015 14:08
比较2个文件内容的不同

比较2个文件内容的不同行数

sort file1 file2 | uniq -u > file3

查找文件中的重复行

cat file | sort | uniq -d