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 confluent_kafka import Consumer, KafkaError | |
import time | |
c = Consumer({'bootstrap.servers': 'localhost:9092', 'group.id': 'first', | |
'default.topic.config': {'auto.offset.reset': 'smallest'}}) | |
c.subscribe(['test_once_ok_ok_ok']) | |
start = time.time() | |
running = True | |
items = [] |
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 asyncio | |
@asyncio.coroutine | |
def do_three_things(n): | |
print("{} start".format(n)) | |
message = yield from create_message_one(n) | |
print(message) | |
message = yield from create_message_two(n) | |
print(message) | |
message = yield from create_message_three(n) |
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 sys | |
import subprocess | |
import shlex | |
import time | |
import threading | |
interval = 2 # in seconds | |
command = 'ping 8.8.8.8' | |
def print_(s): |
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 os | |
import re | |
import socket | |
import ssl | |
import sys | |
import time | |
from collections import namedtuple | |
import ConfigParser | |
import httplib |
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 time | |
from collections import deque | |
def time_lookup(l, i): | |
start = time.time() | |
r = i in l | |
return time.time() - start | |
def dict_lookup(d, i): | |
start = time.time() |
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
package main | |
//golang implentation of heap algo | |
//https://en.wikipedia.org/wiki/Heap%27s_algorithm | |
//Result datastructure should be changed to fit your needs | |
func permutations(a []int) [][]int { | |
n := len(a) | |
result := [][]int{} | |
c := make([]int, n) |
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
# start 10 workers | |
# python worker.py -w 10 | |
# produce 100 item with | |
# python worker.py -p 100 | |
import sys | |
import time | |
import syslog |
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
package main | |
import "fmt" | |
func main() { | |
result := make(chan string, 1000) | |
entrophy := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" | |
go combinations(entrophy, 7, result) | |
i := 1 | |
for val := range result { |
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 time | |
from workers import RedisQueue | |
from workers import startapp | |
config = { | |
"namespace": "removeme", | |
"key": "tasks", | |
"redis_config": {}, | |
"maxsize": 100 | |
} |
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 sys | |
from syslog import syslog as syslog_func | |
from datetime import datetime | |
def stdout_func(msg): | |
sys.stdout.write(msg + '\n') | |
class Logs: |
OlderNewer