Skip to content

Instantly share code, notes, and snippets.

View shinux's full-sized avatar
🦉
Illusion And Real Difference

Sinux shinux

🦉
Illusion And Real Difference
View GitHub Profile
import crypto from 'crypto';
function gen(password) {
const randomSalt = crypto.randomBytes(16).toString('base64');
const bufferSalt = new Buffer(randomSalt, 'base64');
const hashPassword = crypto.pbkdf2Sync(password, bufferSalt, 10000, 64).toString('base64');
console.log('salt', randomSalt);
console.log('password', hashPassword);
return (randomSalt, hashPassword);
}
@shinux
shinux / checkout_all_typechange.sh
Created March 26, 2016 06:28
check out all git type change of symlink file
git status | grep typechange | awk '{print $2}' | xargs git checkout
@shinux
shinux / proxy.js
Last active February 1, 2016 02:41
Synchronous proxy
/**
*
* 异步 get 需要回调
**/
let choice = 'a';
let proxyList = [];
function initProxyWayA() {
@shinux
shinux / .jshintrc
Created January 23, 2016 02:29
atom jshintrc for es6
{
"esnext": true
}
@shinux
shinux / 2to3
Created December 28, 2015 02:33
simple2to3
if PY3:
string_types = str,
integer_types = int,
text_type = str
xrange = range
else:
string_types = basestring,
integer_types = (int, long)
text_type = unicode
xrange = xrange
@shinux
shinux / print_days_range
Last active August 29, 2015 14:25
计算之道,京东/人人场,第一题 python2.7.9解。
import datetime
base_dict = {
'0': 6,
'1': 2,
'2': 5,
'3': 5,
'4': 4,
'5': 5,
[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_