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
#!/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
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 random | |
runs = 10000 | |
rate = 100 | |
for _ in range(50): | |
real_sum = 0 | |
real_cnt = 0 | |
est_sum = 0 | |
est_cnt = 0 | |
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
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
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
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
#!/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
#!/usr/bin/python | |
## gitsh (pronounced like "glitch"), an interactive wrapper for git. | |
## | |
## gitsh parses the output of "git status" and numbers the files for | |
## you, for easy operations on multiple files. | |
## | |
## $ gitsh status | |
## 1) M foo/bar.py | |
## 2) M foo/baz.py | |
## 3) A blah.sh |
OlderNewer