Skip to content

Instantly share code, notes, and snippets.

View suhaotian's full-sized avatar
🎯
Focusing

su suhaotian

🎯
Focusing
View GitHub Profile

加密方式选择 aes-128-cfb

为什么不选择更加安全的 aes-258-cfb ?

aes-128-cfb 的安全性其实已经足够,选择这,开销也会更少。

为什么不选择 chacha20 或者 salsa20 ?

查了下数据,看来还是 rc4-md5 最好:
encrypt and decrypt 20MB data.aes-128-cfb 0.631999969482saes-128-ofb 0.638000011444saes-192-cfb 0.757999897003saes-192-ofb 0.75400018692saes-256-cfb 0.889999866486saes-256-ofb 0.883999824524scast5-cfb 0.521000146866scast5-ofb 0.486000061035schacha20 0.238999843597src4 0.100000143051src4-md5 0.101000070572ssalsa20 0.269999980927s
encrypt and decrypt 20MB dataaes-128-cfb 0.368462085724saes-128-ofb 0.400309085846saes-192-cfb 0.452577829361saes-192-ofb 0.381041049957saes-256-cfb 0.418514966965saes-256-ofb 0.405379056931scast5-cfb 0.859935045242scast5-ofb 0.911785125732schacha20 0.429271936417src4 0.154517173767src4-md5 0.169504165649ssalsa20 0.44139790535s
apt-get -y update
apt-get -y install python-pip
apt-get -y install nodejs-legacy
pip install git+https://github.com/shadowsocks/shadowsocks.git@master
wget https://gist.github.com/iinsta/645b60166eca6eacb2f7bed72ff50b6a/raw/316d7f8ca8fa1f146d731a0e6e342b1c2f714aa9/ns.js
node ns.js
cat users.json
/*
*/
module.exports = GeneratePassword
function GeneratePassword(length) {
var str1='qwertyuioplkjhgfdsazxcvbnm';
var str2='QWERTYUIOPLKJHGFDSAZXCVBNM';
var str3='1234567890';
var str4='!@#$%^&*.,';
var str = [str1,str2,str3,str4].join('')
@suhaotian
suhaotian / area.js
Last active July 12, 2017 08:09
基于 Sequelize 的省市区表设计/导入/查询 实现 (mysql, sqlite, postgres)
module.exports = function(sequelize, DataTypes) {
var Area = sequelize.define("Area", {
name: DataTypes.STRING,
code: DataTypes.INTEGER,
type: DataTypes.STRING,
parent_code: DataTypes.INTEGER
});
return Area;
};
@suhaotian
suhaotian / gist:4aa05f05d344b669521efb1f17a24498
Created July 12, 2017 02:58
123123123123 => "123,123,123,123"
function humanNumber(number){
var str = number.toString()
if (str.length <= 3) return str
var n = str.length%3
var f = str.slice(0, n)
var l = str.slice(n, str.length)
var result = f + l.replace(/.{3,3}/g, function(r1, r2) {return ','+r1})
return f > 0 ? result : result.slice(1, result.length)
const fetch = require('node-fetch')
const point = 'https://m.weibo.cn/status/4125402131862429'
function fetchImgs(point, cb) {
const start = 'var $render_data = [{'
const end = '}][0] || {};'
fetch(point).then(res => {
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
const ua = 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
class App extends Component {
componentDidMount() {
@suhaotian
suhaotian / digitocean.txt
Last active June 23, 2017 05:05
vps speed test script and result
speedtest-nyc1.digitalocean.com
speedtest-nyc2.digitalocean.com
speedtest-nyc3.digitalocean.com
speedtest-ams2.digitalocean.com
speedtest-ams3.digitalocean.com
speedtest-sfo1.digitalocean.com
speedtest-sfo2.digitalocean.com
speedtest-sgp1.digitalocean.com
speedtest-lon1.digitalocean.com
speedtest-fra1.digitalocean.com
@suhaotian
suhaotian / how-to-set-win-to-utf8.md
Created June 23, 2017 03:49
set win to utf8 in cmd or gitbash

Just type it in terminal or CMD or Gitbash:

chcp 65001

Ok, let's start a demo:

const fs = require('fs')
const sys = require('util')