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
[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_
@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,
@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 / .jshintrc
Created January 23, 2016 02:29
atom jshintrc for es6
{
"esnext": true
}
@shinux
shinux / proxy.js
Last active February 1, 2016 02:41
Synchronous proxy
/**
*
* 异步 get 需要回调
**/
let choice = 'a';
let proxyList = [];
function initProxyWayA() {
@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
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);
}
javascripts/
stylesheets/
cmap/
vendor/
*.eot
*.svg
*.ttf
*.woff
@shinux
shinux / partial_update_maybe_issue
Created November 21, 2016 05:37 — forked from alexsisu/partial_update_maybe_issue
ElasticSearch partial field update: remove element from array, does not work
curl -XPUT 'http://localhost:9200/testindex' -d '{
"settings":
{
"number_of_shards": 1,
"number_of_replicas": 0
}
}
'
curl -XPUT 'http://localhost:9200/testindex/posting/_mapping' -d '
@shinux
shinux / gist:d913b2ee0e02bb6afb2cbcfbb40615eb
Created February 7, 2017 02:29
ImportError: pycurl: libcurl link-time version (7.49.1) is older than compile-time version (7.51.0)
brew install curl
brew link curl --force
brew install openssl
export LIBRARY_PATH=/usr/local/opt/openssl/lib
export CPATH=/usr/local/opt/openssl/include
pip --no-cache-dir install pycurl
python -c "import pycurl"