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 math import sqrt, ceil | |
from gmpy import mpz, is_square, is_prime | |
fermat = 5959 | |
rsa64 = 16748810522526493651 | |
n = rsa64 | |
report_batch = 1000000 |
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 math,re | |
# binary "oodles of magnitude" | |
KB = 2 ** 10 | |
MB = 2 ** 20 | |
GB = 2 ** 30 | |
TB = 2 ** 40 | |
PB = 2 ** 50 | |
# decimal "oodles of magnitude" |
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 basin | |
import string | |
from hashlib import sha1 | |
## Fixed-length compact ids for compound keys. Given one or more strings, this will | |
## concat with delim (default '|'), sha1 hash the result, convert to the given base | |
## (default 62), truncate to the given length (default 12) and left-pad with zeros. | |
## | |
## *** WARNING MATH AHEAD *** | |
## Here's a handy way to approximate the birthday number for a given bitspace and a |
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 python2.7 | |
# Note: this script is for manual benchmarking! | |
# ./benchmark init-spatial | |
# time ./benchmark write-spatial | |
# ./benchmark read-spatial | |
from memsql.common import connection_pool | |
import random, math, sys |
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
#!/bin/bash | |
# find-out-what-is-using-your-swap.sh | |
# -- Get current swap usage for all running processes | |
# -- | |
# -- rev.0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting | |
# -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output | |
# -- rev.0.1, 2011-05-27, Erik Ljungstrom - initial version | |
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
--- ext/standard/string.c (revision 301280) | |
+++ ext/standard/string.c (working copy) | |
@@ -1674,6 +1674,105 @@ | |
} | |
/* }}} */ | |
+#define FASTSEARCH_MIN 50 | |
+ | |
+/* | |
+ * Implementation of "fastsearch" algorithm devised by |
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
CREATE TABLE `analytics` ( | |
`classifier_id` bigint unsigned, | |
`ts_msec` bigint unsigned, | |
`value` double, | |
PRIMARY KEY (`classifier_id`,`ts_msec`), | |
KEY `ts_msec` (`ts_msec`) | |
); | |
CREATE /*!90618 REFERENCE*/ TABLE `classifiers` ( | |
`id` bigint(20) unsigned NOT NULL, |
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 flask import Flask | |
import torndb | |
## NB: this default query does not exercise leaf connectivity or | |
## partition health. For best results, use a query that selects | |
## a record from an actual data table. | |
SQL = "select count(1) from information_schema.processlist" | |
## SQL = "select * from dashboard.analytics limit 1" | |
## SQL = "show databases extended" |
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 hashlib import md5 | |
bloom = 0b0 | |
num_bits = 512 | |
def add_to_bloom(s): | |
global bloom | |
# int representation of the hashed value | |
hash = int(md5(s.encode('utf8')).hexdigest(), 16) |
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 | |
runs = 10000 | |
rate = 100 | |
for _ in range(50): | |
real_sum = 0 | |
real_cnt = 0 | |
est_sum = 0 | |
est_cnt = 0 | |
NewerOlder