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 requests | |
import json | |
# This is Akshit Khurana's script from Quora answer with minor modifications | |
# http://qr.ae/pLLZL | |
# Get your token from https://developers.facebook.com/tools/explorer/ | |
TOKEN = '' | |
# Get unix epoch time just before your birthday | |
# http://www.epochconverter.com/ |
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
template<typename T, typename U> | |
int process_param(void) | |
{ | |
T p; | |
..... | |
..... | |
U v; | |
..... | |
..... | |
} |
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
if (type == "int") { | |
process_param<UParamInt, int>(); | |
} else if (type == "float") { | |
process_param<UParamFloat, float>(); | |
} else if { | |
.... | |
} |
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
typedef int (*ProcessParamFuncPtr)(void); | |
typedef std::map< std::string, ProcessParamFuncPtr> ProcessFuncMap; | |
// Initialize map with appropriate functions for the datatype. | |
ProcessFuncMap map = boost::assign::map_list_of | |
("int64", process_param< UConfigParamInt, int >) | |
("bool", process_param< UConfigParamBool, bool >) | |
("float", process_param< UConfigParamFloat, float >) | |
("string", process_param< UConfigParamString, std::string>); |
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
``` | |
/* | |
* Given an array A[ ] denoting heights of N towers and a positive integer K, modify the heights of each tower | |
* either by increasing or decreasing them by K only once and then find out the minimum difference | |
* of the heights of shortest and longest towers. | |
* Input : A[] = {1, 15, 10}, k = 6 Output : 5 Explanation : We change 1 to 6, 15 to 9 and 10 to 4. | |
*Maximum difference is 5 (between 4 and 9). We can't get a lower difference. | |
* you have time till 4.50 | |
* good luck | |
* more examples |
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
W1023 23:50:07.841426 8016 consensus_peers.cc:458] T 08fb4f5fe94e4a20b87ab1d988f2844f P 8f6b5457217c402abfe1ec42acfdd669 -> Peer bb6f9f5dcfe044a1acffbd399ef2ee85 (127.6.163.129:39163): Couldn't send request to peer bb6f9f5dcfe044a1acffbd399ef2ee85. Status: Network error: Client connection negotiation failed: client connection to 127.6.163.129:39163: connect: Connection refused (error 111). This is attempt 1: this message will repeat every 5th retry. | |
W1023 23:50:07.842099 8128 heartbeater.cc:571] Failed to heartbeat to 127.6.163.190:46131 (0 consecutive failures): Network error: Failed to send heartbeat to master: Client connection negotiation failed: client connection to 127.6.163.190:46131: connect: Connection refused (error 111) | |
W1023 23:50:07.940315 8018 consensus_peers.cc:458] T 08fb4f5fe94e4a20b87ab1d988f2844f P 8f6b5457217c402abfe1ec42acfdd669 -> Peer 55303644da3342618c8c474f930c0038 (127.6.163.133:36745): Couldn't send request to peer 55303644da3342618c8c474f930c0038. Status: Network error: Client c |
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
(gdb) bt | |
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 | |
#1 0x00007f9bf4c73801 in __GI_abort () at abort.c:79 | |
#2 0x0000000004efac94 in google::DumpStackTraceAndExit() () | |
#3 0x0000000004ef16ed in google::LogMessage::Fail() () | |
#4 0x0000000004ef2f92 in google::LogMessage::SendToLog() () | |
#5 0x0000000004ef10c7 in google::LogMessage::Flush() () | |
#6 0x0000000004ef1429 in google::LogMessage::~LogMessage() () | |
#7 0x0000000001cb95ce in impala::LogKuduMessage (unused=0x0, severity=kudu::client::SEVERITY_FATAL, | |
filename=0x7f9bf6f7e778 "/home/wzhou/projects/native-toolchain/source/kudu/kudu-00e7ca643/src/kudu/util/block_bloom_filter.cc", line_number=265, time=0x7f9bf7159380 <google::fatal_msg_data_exclusive+30400>, |
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
The _for128 and _for256 basically uses blocks of 128/256 input integers to calculate the diff | |
and min across the block simulating the mechanism used in Kudu's encoding implementation. | |
$ python codec-test.py repeat_small_range.csv | |
+--------------------------+----------------------+------------------------+--------------+ | |
| codec | comp_time(millisecs) | decomp_time(millisecs) | bits_per_int | | |
+--------------------------+----------------------+------------------------+--------------+ | |
| bitshuffle | 42.511 | 165.078 | 0.4868 | | |
| simdbinarypacking | 33.127 | 34.271 | 7.0821 | |
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 random | |
import sys | |
# 10M values to be generated | |
count = 10 * 1024 * 1024 | |
def gen_repeat_in_small_range(): | |
for i in range(0, int(count/256/256)): | |
for j in range(0, 256): | |
for k in range(0, 256): |
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
# Modification of codec-test.py from Todd Lipcon to be python3 compatible and some formatting of output. | |
# https://github.infra.cloudera.com/raw/todd/experiments/master/kudu/codec-test.py | |
import pyfastpfor | |
import numpy as np | |
import pandas as pd | |
from timeit import Timer | |
import bitshuffle | |
import sys | |
from prettytable import PrettyTable |
OlderNewer