Skip to content

Instantly share code, notes, and snippets.

Avatar
🙊

MoreFreeze morefreeze

🙊
View GitHub Profile
View cpp_template.cpp
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
View rust.vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
View find_bad_float.py
# coding: utf-8
from __future__ import print_function
import csv
import sys
import datetime
from tqdm import tqdm
import importlib
import re
from decimal import Decimal
View stop_itunes.scpt
tell application "iTunes"
play
delay 25*60
pause
dispaly dialog "You need a break"
end tell
View eg_arg.py
import argparse
arg_parser = argparse.ArgumentParser()
def time_argument(func):
def _(*args, **kwargs):
arg_parser.add_argument('-b', '--begin_time', nargs='?', default=None, help='begin time, use yesterday if omit')
arg_parser.add_argument('-e', '--end_time', nargs='?', default=None, help='end time, use next day of begin_time if omit')
return func(*args, **kwargs)
return _
@morefreeze
morefreeze / hql2csv.py
Created Jan 24, 2018
Convert hql to csv format
View hql2csv.py
# coding: utf-8
from __future__ import print_function
import subprocess
import sys
import argparse
def main():
parser = argparse.ArgumentParser()
mut_group = parser.add_mutually_exclusive_group()
@morefreeze
morefreeze / multimatch.cc
Last active Jul 27, 2018
multithread on get_postlist
View multimatch.cc
// It need push_back postlist by order, so record pl_map[i] = pl, then push them orderly.
std::map<int, PostList *> pl_map;
std::vector<std::thread> vt;
std::mutex mutex;
auto start = std::chrono::high_resolution_clock::now();
for (size_t i = 0; i != leaves.size(); ++i) {
vt.push_back(std::thread([this, first, maxitems, start, &total_subqs, &pl_map, &definite_matches_not_seen, &mutex](size_t ii) {
PostList *pl = leaves[ii]->get_postlist(this, &total_subqs);
if (false && is_remote[ii]) { // use localmutltimatch, so don't go here
if (pl->get_termfreq_min() > first + maxitems) {