Skip to content

Instantly share code, notes, and snippets.


Mirko Bonasorte fcracker79

Block or report user

Report or block fcracker79

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import datetime
import random
import typing
import unittest
from collections import OrderedDict
class Passage:
def __init__(self, aos: datetime.datetime):
self.aos = aos
fcracker79 /
Created Apr 8, 2018 — forked from ursuad/
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/ --zookeeper localhost:2181 --list

Describe a topic

bin/ --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/ --zookeeper localhost:2181 --alter --topic mytopic --config

... 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
values = list(range(1, _MAX_VALUE + 1))
import subprocess
class RunCmd(object):
def __init__(self, cmd):
self.cmd = cmd
def cmd_run(self):, shell=True)
import itertools
def a_default_value():
return 1
def b_default_value():
return 'hello'
fcracker79 /
Created Jun 29, 2019
RustHero Rustlab Florence 2019
use std::str;
struct ReadLoud<'a> {
current_element: Option<u32>,
numbers_iterator: str::Chars<'a>,
next_elements: Vec<u32>
impl <'a> ReadLoud<'a> {
View gist:e51b6bcb123188627a3fdb008e6c38ef
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 {
// println!("Element {:?}", x);
// }
// This works
View gist:2a895137b8874a40d4bd4854a7f509be
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));
You can’t perform that action at this time.