I hereby claim:
- I am pjz on github.
- I am pjz (https://keybase.io/pjz) on keybase.
- I have a public key whose fingerprint is 6B5E E345 00C0 73D0 2B56 55C4 1F2F D328 D987 D2AE
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
static char* ICACHE_FLASH_ATTR findUrlPathStart(char *url) { | |
int i = 7; // skip 'http://' | |
while (url[i] != '/') { i++; } | |
return &url[i]; | |
} | |
void ICACHE_FLASH_ATTR httpClientFetch(char *url, int retbufsz, void (*cb)(char*)) { | |
static struct espconn conn; | |
static ip_addr_t ip; | |
char *hcserver = url[7]; // skip 'http://' |
#!./goscript | |
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
func main() { | |
fmt.Println("hello"); |
""" | |
ActorHandler - class-based dispatch for actors | |
Usage: | |
from thespian.actors import Actor | |
handler = ActorHandler() | |
class Hello(Actor): |
""" | |
RegistryActor - a dict-based dispatcher for actors | |
Usage: | |
from .actors import RegistryActor | |
class Hello(RegistryActor): | |
def __init__(self): | |
super(self.__class__, self).__init__() |
import random | |
def tosses_until(s): | |
tosses = '' | |
while not tosses.endswith(s): | |
tosses += random.choice('HT') | |
return len(tosses) | |
TRIALS = 10000 |
""" | |
Replaced by https://github.com/godaddy/Thespian/blob/master/contrib/websocket.py | |
""" |
""" | |
Using a class decorator | |
Usage: | |
@Actorize | |
class Hello(Actor): | |
@handle(SomeMessageClass) | |
def somemethod(self, msg, sender): |
import timeit | |
class Foo: pass | |
foo = Foo() | |
sfoo = 'foo' * 333 | |
sfo = 'foo' * 332 | |
dfoo = { 'foo': 1, 'bar': 2, 'baz': 3, 'bal': 4 } | |
setfoo = set(['foo', 'bar', 'baz', 'bal']) |
def test_ma_short_skips(): | |
ma = MovingAverage([1,2,5,10]) | |
for i in range(11): | |
ma.update(i, 5) | |
assert ma.cur == [ 5, 5, 5, 5 ] | |
ma = MovingAverage([1,2,3]) |