Skip to content

Instantly share code, notes, and snippets.

View dvtomas's full-sized avatar
🐔

Tomas Dvorak dvtomas

🐔
View GitHub Profile
# rust-slicedeque.exe 1 100 1 105 1 100
# global_time action thread time[us] grow/truncate_size total_queue_size
9 GROW 0 0 1 101
42 TRUNC 0 4 1 100
51 GROW 0 0 106 206
421 TRUNC 0 363 101 105
428 GROW 0 0 211 316
1190 TRUNC 0 755 201 115
1199 GROW 0 1 316 431
2321 TRUNC 0 1116 301 130
@dvtomas
dvtomas / dmn.md
Last active April 20, 2018 03:25

Send command:

1B delka ( = CommandData.len() + 3)
1B Command code
... Command data
1B Chksum

Read response

@dvtomas
dvtomas / ProducerConsumerSubscriber.scala
Last active February 2, 2016 15:00
crazy Monix operator producerConsumer
package info.td.common.monix.impl
import java.util.concurrent.Semaphore
import info.td.common.monix.ProducerConsumerStrategy
import monifu.reactive.Ack.{Cancel, Continue}
import monifu.reactive.observers.SynchronousSubscriber
import monifu.reactive.{Ack, Subscriber}
import scala.annotation.tailrec
val scheduler = schedulerProvider.defaultScheduler
val xs = collection.mutable.ArrayBuffer[Seq[Long]]()
var completed = false
val o =
Observable
.intervalAtFixedRate(timeSlice)
.take(10)
package info.td.common.monix.impl
import monifu.concurrent.atomic.padded.Atomic
import monifu.reactive.Ack.{Cancel, Continue}
import monifu.reactive.exceptions.BufferOverflowException
import monifu.reactive.observers.{BufferedSubscriber, SynchronousSubscriber}
import monifu.reactive.{Ack, Subscriber}
import scala.annotation.tailrec
import scala.util.Failure
@dvtomas
dvtomas / gist:2937150
Created June 15, 2012 15:47
Higher order C macros
http://evincarofautumn.blogspot.cz/2012/04/c-functional-style-tips.html
"
When C++ fails to provide a mechanism of semantic abstraction for a particular problem, higher-order macros at least allow you to abstract syntactically repetitive code. Judicious use of macros to reduce repetition is a Good Thing, even if it might make you feel a bit dirty.
"
#define LETTERS_SMALL(M)\
M(a)\
M(b)\
M(c)