Skip to content

Instantly share code, notes, and snippets.

import time
import random
import string
TEST_STR = "".join([string.letters[random.randint(1, len(string.letters)-1)] for x in range(0, 10000)])
start_time = time.time()
TEST_STR.upper()
print "UPPER", time.time() - start_time
# bob
import string
class Bob(object):
def hey(self, spoken):
words = spoken.strip()
# Default response
response = "Whatever."
if self.isBlank(words):
-module(tree).
-export([empty/0, insert/3, lookup/2]).
-export([construct/2, construct_test/0]).
empty() -> {node, 'nil'}.
insert(Key, Val, {node, 'nil'}) ->
-module(same_string).
-export([test/0,
is_re_message_the_same/2,
is_message_the_same/2]).
%% XXX - make sure this works with unicode
non_word() ->
[$\n, $\r, $\t,$!,$",$#,$$,$%,$&,$',$(,
$),$*, $+,$,, $\\, $-,
@twonds
twonds / README.md
Last active January 21, 2019 11:39
Datadog stream parser for json

dd-udpstream

Parse json events into data dog events

Testing

@twonds
twonds / twistd.log
Created September 18, 2014 23:10
datadog debugging events
2014-09-18 22:57:54+0000 [DispatcherFromUDPLogProtocol (UDP)] {
"category": "hullabaloo_chaos",
"node": "rte_v1_v2_test@ip-10-33-16-217",
"nodes": [
"rte_v1_v2_test@ip-10-33-16-217",
"rte_v1_v2_test@ip-10-41-64-106"
],
"result": true,
"timestamp": 1411081075,
"what": "kill_process"
-module(ets_update).
-compile(export_all).
setup() ->
ets:new(test, [public, named_table]),
ets:insert(test, {test, 0}).
lookup(N) ->
ets:lookup(test, N).

call the following:

api.create_dashboard(
                  title, description,
                  graphs, template_vars)

where the values are the following:

title="pubsub-bench"
@twonds
twonds / .emacs
Created October 13, 2015 04:02
save my emacs file
;;Required plugins:
;Erlang OTP, color-theme, distel, auto-complete-distel
;
;; Erlang
(setq load-path (cons "/otp/17.4/lib/tools-2.7.1/emacs" load-path))
(setq erlang-root-dir "/otp/17.4/")
(setq inhibit-splash-screen t)
(setq exec-path (cons "/otp/R15B/lib/erlang/bin" exec-path))
#!/bin/bash
PGSQL_DIR=/usr/local/pgsql
export PGDATA=${PGSQL_DIR}/data
if [ ! -e ${PGDATA}/PG_VERSION ]
then
initdb -D ${PGDATA}
fi
echo ${PGSQL_DIR}
postgres -D ${PGDATA} > ${PGSQL_DIR}/logfile 2>&1 &
echo $! > ${PGSQL_DIR}/pg.pid