bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
| import datetime | |
| import random | |
| import typing | |
| import unittest | |
| from collections import OrderedDict | |
| class Passage: | |
| def __init__(self, aos: datetime.datetime): | |
| self.aos = aos |
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
| import itertools | |
| import typing | |
| from pprint import pprint | |
| def full_join(d1: typing.Optional[dict], d2: typing.Optional[dict]) -> typing.Optional[dict]: | |
| if d1 is None or d2 is None: | |
| return None | |
| return {k: d1.get(k, d2.get(k)) for k in itertools.chain(d1, d2)} |
| import collections | |
| _ApiMethod = collections.namedtuple('_ApiMethod', ['name', 'path', 'http_method', 'query_params']) | |
| API = [ | |
| _ApiMethod('print_hello', 'api/hello', "GET", ['limit']), | |
| ] | |
| import itertools | |
| import pprint | |
| import typing | |
| _SELECTED = 5 | |
| _MAX_VALUE = 40 | |
| values = list(range(1, _MAX_VALUE + 1)) | |
| _REQUIRED_SUM = _MAX_VALUE // 2 |
| import subprocess | |
| class RunCmd(object): | |
| def __init__(self, cmd): | |
| self.cmd = cmd | |
| def cmd_run(self): | |
| subprocess.call(self.cmd, shell=True) |
| import itertools | |
| def a_default_value(): | |
| return 1 | |
| def b_default_value(): | |
| return 'hello' |
| use std::str; | |
| struct ReadLoud<'a> { | |
| current_element: Option<u32>, | |
| numbers_iterator: str::Chars<'a>, | |
| next_elements: Vec<u32> | |
| } | |
| impl <'a> ReadLoud<'a> { |
| struct NiceStructure<'a, T: Iterator<Item=&'a u32>> { | |
| it: T | |
| } | |
| fn f<'a, T: Iterator<Item=&'a u32>>(it: &mut NiceStructure<'a, T>) { | |
| // This does not work: cannot move out of borrowed content | |
| // for x in it.it { | |
| // println!("Element {:?}", x); | |
| // } | |
| // This works |
| use std::sync::Arc; | |
| use std::thread; | |
| use std::time::Duration; | |
| fn main() { | |
| let ref_counter = Arc::new(true); | |
| for i in 0..10 { | |
| let cur_ref_counter = Arc::clone(&ref_counter); | |
| thread::spawn(move || { | |
| thread::sleep(Duration::from_secs(i + 1)); |