View block_stupid_makeding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1 xmindchina.net | |
127.0.0.1 www.xmindchina.net | |
127.0.0.1 www.ntfsformac.cc | |
127.0.0.1 www.makeding.com | |
127.0.0.1 makeding.com | |
127.0.0.1 vm.makeding.com | |
127.0.0.1 www.bingdianhuanyuan.cn | |
127.0.0.1 xia.bingdianhuanyuan.cn | |
127.0.0.1 bingdianhuanyuan.cn | |
127.0.0.1 huishenghuiying.com.cn |
View search_subslice.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// search all sub slices | |
func SearchSubSlice(mainSlice, subSlice []byte) []int { | |
var result []int | |
result = nil | |
// 主切片为空,直接返回 nil | |
// if main slice is nil or empty, just return nil | |
if mainSlice == nil { |
View create_specified_size_file_by_random_content.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
__author__ = 'Jux.Liu' | |
import os | |
from subprocess import Popen | |
from time import sleep | |
cmd_new_file_multiline = 'base64 /dev/urandom 2>>/dev/null | head -c {filesize} > ./{size}{unit}_{file_no} && echo "" >> ./{size}{unit}_{file_no}' | |
cmd_new_file_one_line = 'tr -dc A-Za-z0-9 </dev/urandom 2>>/dev/null | head -c {filesize} > ./{size}{unit} && echo "" >> ./{size}{unit}' | |
cmd_one_file_multiline = 'base64 /dev/urandom 2>>/dev/null | head -c {filesize} >> ./{size}{unit}_{file_no} && echo "" >> ./{size}{unit}_{file_no}' |
View get_char_without_enter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
__author__ = 'Jux.Liu' | |
import termios | |
import sys, tty | |
def getch(): | |
def _getch(): | |
fd = sys.stdin.fileno() |
View remove_copy_listener.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:getEventListeners(document).copy.forEach(({listener}) => document.removeEventListener('copy', listener)) |
View pick_from_json.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
__author__ = 'Jux.Liu' | |
def pick_from_json(json_obj, key_path, key_sep='.', list_index_start='$_', list_index_end='_$'): | |
if key_sep in list_index_start or key_path in list_index_end: | |
raise Exception('pick another key sep') | |
key_list = key_path.split(key_sep) | |
sub_obj = json_obj |
View auto_gen_seconds_per3s.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for t in range(130000, 140000, 100): | |
if int(str(t)[2]) > 5: | |
break | |
for i in range(t, t+100, 3): | |
if int(str(i)[-2]) > 5: | |
break | |
print('elif {} < int_time <= {}:'.format(i, i + 3)) | |
print("\tres = {} if align == 'floor' else {}".format(i, i + 3)) |
View argparse.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin python | |
# coding: utf-8 | |
import sys | |
from argparse import ArgumentParser | |
from os.path import exists | |
def main(*args): | |
start = args[0].start |
View update-mongodb-collection-field-type.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.getCollection('years3').find().forEach(function(doc) { | |
var a = String(doc.date); | |
var d = new Date(a.substr(0,4)+'/'+a.substr(4,2)+'/'+a.substr(6,2)); | |
db.getCollection('years3').update( {_id: doc._id}, {$set: {date: d}}); | |
}); |
View cors.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cors(func): | |
@wraps(func) | |
def wrapper_func(*args, **kwargs): | |
r = make_response(func(*args, **kwargs)) | |
# list your access domain here | |
# if set 'Access-Control-Allow-Credentials', this cannot be *. | |
# must match the require domain | |
r.headers['Access-Control-Allow-Origin'] = '*' | |
r.headers['Access-Contorl-Allow-Methods'] = 'GET, POST, PUT, DELETE' # list your access methods here | |
allow_headers = "Referer, Accept, Origin, User-Agent" |
NewerOlder