Skip to content

Instantly share code, notes, and snippets.

@mfelsche
mfelsche / tremor_redpanda.log
Created December 10, 2021 15:22
Tremor Redpanda Logs
104_redpanda_elastic_correlation-tremor_out-1 | 2021-12-10T15:17:01.828694200+00:00 INFO tremor_runtime::system - Binding onramp tremor://localhost/onramp/redpanda-in/01/out
104_redpanda_elastic_correlation-tremor_out-1 | 2021-12-10T15:17:01.830056300+00:00 INFO tremor_runtime::source::kafka - [Source::tremor://localhost/onramp/redpanda-in/01/out] Starting kafka onramp
104_redpanda_elastic_correlation-tremor_out-1 | 2021-12-10T15:17:01.831848100+00:00 INFO tremor_runtime::source::kafka - [Source::tremor://localhost/onramp/redpanda-in/01/out] Subscribing to: ["tremor"]
104_redpanda_elastic_correlation-tremor_out-1 | 2021-12-10T15:17:01.832735600+00:00 INFO tremor_runtime::source::kafka - [Source::tremor://localhost/onramp/redpanda-in/01/out] Subscription initiated...
104_redpanda_elastic_correlation-tremor_out-1 | 2021-12-10T15:17:01.833342+00:00 INFO tremor_runtime::onramp - Onramp tremor://localhost/onramp/redpanda-in/01/out started.
104_redpanda_elastic_correlation-tremor_out-1 | 202
@mfelsche
mfelsche / config.yaml
Created September 9, 2021 12:49
Tremor Config to consume json documents from udp and forward them to kafka while applying backpressure in case of error or timeout after > 1s
onramp:
- id: udp_in
type: udp
codec: json
config:
host: localhost
port: 65535
offramp:
- id: kafka_out
type: kafka
@mfelsche
mfelsche / sled_experiment.rs
Created May 4, 2021 07:16
Sled Experiment for watching the consumed disk_space
use sled;
fn main() {
let db = sled::open("/path/to/sled").unwrap();
//let db = sled::Config::default().temporary(true).open().unwrap();
let tree = db.open_tree("events").unwrap();
let mut cnt = 0_u64;
let mut size = 0_u64;
let mut last_id: Option<u64> = None;
@mfelsche
mfelsche / hashing_bench.pony
Created September 7, 2020 22:02
ponylang benchmark for checking performance of hashing in general and some hashmap ops between master and hashing_builtin branch
use "ponybench"
use "collections"
use "random"
actor Main is BenchmarkList
new create(env: Env) =>
PonyBench(env, this)
fun tag benchmarks(bench: PonyBench) =>
@mfelsche
mfelsche / pony_hkt_checklist.md
Last active February 1, 2019 13:00
Ponylang HKT implementation checklist: https://github.com/ponylang/rfcs/pull/134
  • how to handle reification of types with a HKT type-param?
    • if the hkt-type-param is not used: class Foo[F[_]]
    • if the hkt-type-param is used in method signatures:
      trait Foo[F[_]]
        def map[A](a: A): F[A]
      
    • if the hkt-type-param is used in the body of a function with a concrete type (is that even possible? where should it get that type from?):

trait Foo[F[_]]

@mfelsche
mfelsche / gist:ef4dd9e104a8127e820b6e4e20c88b2c
Created January 25, 2019 05:04
Setup pony debugging with vscode
The basic steps are here
```
install https://marketplace.visualstudio.com/items?itemName=npruehs.pony <- for syntax colors
install https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb <- for debugging
#vscode settings should have :
"debug.allowBreakpointsEverywhere": true
#(for example ) create an ./examples/.vscode/launch.json file under the pony examples directory with:
{
@mfelsche
mfelsche / known_folders.pony
Created December 28, 2018 21:48
Getting some known folders on windows with Pony
use "debug"
use "lib:shell32" if windows
use "lib:ole32" if windows
primitive KnownFolderIds
"""
Known folder ids as described in:
https://docs.microsoft.com/en-ca/windows/desktop/shell/knownfolderid
functions return the little endian byte values of the folderid GUIDs
@mfelsche
mfelsche / promises_ext.pony
Created December 11, 2018 19:53
first function for promises - returning the first fulfilled value
use "promises"
use "collections"
actor _Selector[A: Any #share]
var _completed: Bool = false
var _outstanding: USize
let _promise: Promise[A]
new create(promise: Promise[A], expected: USize) =>
_promise = promise
@mfelsche
mfelsche / scratch.pony
Created March 26, 2018 07:37
Code to reproduce weird `String.cstring()` behaviour in ponyc
use "net"
use "cli"
use "debug"
actor Main
new create(env: Env) =>
try
let spec = CommandSpec.leaf("damn", "", [
OptionSpec.string("addr",
"The host:port:name to be advertised to other clustering nodes."
@mfelsche
mfelsche / object_ast
Last active December 19, 2017 21:24
pony AST error message for syntax pass on object literal
(class:scope
(id $1$0)
x
ref
(provides (nominal x (id Getter) x x x))
(members
(fvar (id d) (nominal (id $0) (id Bool) x val x x) x)
(fvar (id c) (nominal (id $0) (id Bool) x val x x) x)
(fvar (id b) (nominal (id $0) (id Bool) x val x x) x)
(fvar (id a) (nominal (id $0) (id Bool) x val x x) x)