想要使用https但不想花钱/时间? 借助CloudFlare为网站提供免费的SSL认证

Categories: Development Notes; Tagged with: ; @ February 26th, 2017 22:09

相信很多个人站长都希望通过https向读者提供服务, 要提供https服务, 就首先需要一个通过CA认证的certificate, 可以掏钱买, 也可以通过Let’s Encrypt免费获得.  如果站点用的是github pages静态内容 + 自己的域名, 那么可能这两者可能都不合适.

CloudFlare是一家DNS, CDN等服务供应商, 同时面向个人提供免费的DNS, CDN等服务, 并且提供SSL服务:

Cloudflare SSL Settings

如果要求不高, 只是希望内容通过https分发, 那么可以选择默认的Flexible SSL.  该选项会使最终读者通过https建立与CloudFlare之间的联系. 而CloudFlare与你的server之间会通过http连接.

SSL配置生效后, 你将可以通过http访问你的网站, 并且可以看到https的认证信息.

 

原理

CloudFlare会自动生成一个包含有你的域名*.example.com的共享认证,  最终用户的浏览器会辨识该认证并与CouldFlare建立https连接.

 

Installing ipkg and Python on ASUS RT-N56U Router (Busybox)

Categories: Linux; Tagged with: ; @ May 15th, 2016 15:59
  1. enable ssh
  2. mount your usb drive – make sure it’s not vfat, you may need to format your disk:
    # mkfs.ext4 /dev/sda1
  3. update ipkg.sh:
    # mkdir -p /media/AiDisk_a1/opt
    # mount -o bind /media/AiDisk_a1/opt/ /opt/
    # mkdir -p /opt/tmp/ipkg
    # ipkg.sh update
  4. install ipkg:
    # ipkg.sh install ipkg-opt
  5. install python:
    ipkg install python27

Useful links:

ASUS RT-N56U or hardware NAT acceleration

Error Message:

Unpacking ipkg-opt...tar: can't create symlink from ./opt/bin/ipkg-opt to ipkg: Operation not permitted
tar: can't create symlink from ./opt/lib/libipkg.so to libipkg.so.0.0.0: Operation not permitted
tar: can't create symlink from ./opt/lib/libipkg.so.0 to libipkg.so.0.0.0: Operation not permitted
Done.
Configuring ipkg-opt...Done.

Make sure that your usb drive is not ‘vfat’

Enabling SSH on ASUS RT-N56U Router

Categories: Development NotesLinux; Tagged with: ; @ May 15th, 2016 15:36

the default firmware doesn’t provide the SSH feature, however, with the help of padavan‘s rt-n56u project, you may enable it:

This project aims to improve the rt-n56u and other supported devices on the software part, allowing power user to take full control over their hardware. This project was created in hope to be useful, but comes without warranty or support. Installing it will probably void your warranty. Contributors of this project are not responsible for what happens next.

How do I get set up?

What I did:

  1. download RT-N56U_3.4.3.9-099_base.trx
  2. login to the router setting dashboard, and upgrade the firmware by selecting the downloaded file.
  3. after couple minutes,  my router reset, I connect to the router via cable, and setup wifi. (you may try ‘1234567890’ to connect to your wifi network if you cannot connect to it directly)
  4. login to the router setting dashboard, you’ll find a new UI! navigate to: Advanced Settings > Administration > Services to setup your ssh server.  more details: https://bitbucket.org/padavan/rt-n56u/wiki/EN/CommonTips

程序员的数学 读书笔记

Categories: Development Notes; Tagged with: ; @ May 1st, 2016 17:57

我相信多数人看到这本书之后可能都会轻轻一笑,这太简单了。可对我来说,大多数概念都已经变的很陌生, 粗略读了一遍,顺便复习曾经熟悉的那些数学基础。

零,二进制,十进制,指数

  • 十进制/二进制转换
  • 十进制/罗马数字转换
  • 指数: N^a X N^b = N ^(a+b)
  • 给定一个十进制数字,如何检查该数字是不是2的平方?O(log n) ? O(1)?
  • Counting Bits

余数, 周期性, 分组

排列组合

三种药品,A, B, C 共取100粒,每种至少一粒,不考虑顺序,共有多少种组合方式?

递归

指数

  • 一张厚度为1 mm纸只需要对折39次就可以达到39万公里 -地球与月球之间的距离
  • Binary search algorithm

 

 

Python: multiprocessing forking.py assertionError

Categories: Development NotesPython; Tagged with: ; @ March 22nd, 2016 23:32

Issue:  There’s an AssertionError when I try to test  mutliprocessing features using lettuce 0.2.22 / nosetests and python 2.7.10 error details:

multiprocessing\forking.py AssertionError: main
File "", line 1, in 
File "C:\Python27\Lib\multiprocessing\forking.py", line 380, in main
  prepare(preparation_data)
  File "C:\Python27\Lib\multiprocessing\forking.py", line 488, in prepare
    assert main_name not in sys.modules, main_name
AssertionError: __main__

upgrade to python 2.7.11 becuase this is a fixed bug: https://bugs.python.org/issue10128; or
use a wrapper (.py file name should be not in sys.modules, main_name):

# run_at.py:
__requires__ = 'lettuce==0.2.20'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('lettuce==0.2.20', 'console_scripts', 'lettuce')()
    )

Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.