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/env python | |
# -*- coding: utf-8 -*- | |
import logging | |
import pymongo | |
NEW_HASH = '0f533b43e264260e17fed6a15e05ffd6c3f8e3b1' | |
HASH_TEXT = 'duanwei-儿童' | |
OLD_HASH_LS = ['efacd9afc28bed0712c4e904585f10a277fbfc7d', | |
'59f420d90a824716eb07df9b698aa2ecedf3f0dc', |
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
import os | |
import re | |
import codecs | |
import concurrent.futures | |
import multiprocessing | |
import pandas as pd | |
def worker(task_q): |
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
import queue | |
import random | |
import time | |
from datetime import datetime | |
from itertools import product | |
import concurrent.futures | |
import pandas as pd | |
from pipe import as_list |
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
import datetime | |
from pprint import pprint | |
from collections import defaultdict | |
import numpy as np | |
import pandas as pd | |
def apriori(dataset, min_support=0.5, min_hconf=0.5, verbose=False): | |
"""Implements the Apriori algorithm. |
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
# Some useful commands to use docker. | |
# Author: yeasy@github | |
# Created:2014-09-25 | |
alias docker-pid="sudo docker inspect --format '{{.State.Pid}}'" | |
alias docker-ip="sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}'" | |
#the implementation refs from https://github.com/jpetazzo/nsenter/blob/master/docker-enter | |
function docker-enter() { | |
if [ -e $(dirname "$0")/nsenter ]; then |
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
""" | |
@description: Sortable chain with key, just like sorted. | |
@author: Laisky | |
@copyright: 2015/Laisky | |
@license: MIT/Apache | |
""" | |
from collections import namedtuple | |
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/env python | |
# -*- coding: utf-8 | |
""" | |
@description: Generate network topological graph by pygraphviz_1.3rc. | |
@created_at: Mon Aug 24 16:21:10 2015 | |
@author: Laisky | |
@copyright: 2015/Laisky | |
@license: MIT/Apache |
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
# Inspired by https://gist.githubusercontent.com/leftstick/29e4099a61d2c0182e1fda196eb9e071/raw/4270cf778d70202bfc5d76fdee7e87c628b198e5/commit-msg | |
#!/usr/bin/env bash | |
echo " | |
#!/usr/bin/env bash | |
# regex to validate in commit msg | |
commit_regex='([A-Z]{1,7}-[0-9]{1,7}: .{1,100}(\\\nReviewed by: [a-zA-Z0-9\\.]{1,25})?|(fix|docs|feat|style|refactor|perf|test|chore): .{1,100})' | |
if ! grep -iqE \"\$commit_regex\" \"\$1\"; then | |
echo '\\\033[31m Commit comment format not correct!' |
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
from datetime import datetime | |
import glob | |
from collections import defaultdict | |
import xlrd | |
LEAST_CONT_DAYS = 7 |