Skip to content

Instantly share code, notes, and snippets.

View saarw's full-sized avatar

William Saar saarw

View GitHub Profile
@saarw
saarw / BarChart.tsx
Created May 25, 2020 09:55
React bar chart component in TypeScript
/**
(MIT license)
Copyright (c) 2020 William Saar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
extern crate regex;
extern crate rand;
use std::sync::Arc;
use regex::{RegexBuilder, Regex};
// Counts how many of a specified number of random transformations of a string that matches a certain pattern, returns t
he number of matches or negative for error
#[no_mangle]
pub extern fn match_strings(matcher: Arc<Regex>, num_threads: usize) {
use erased_serde;
use serde_json;
#[derive(Serialize)]
struct Event {
data_point: usize
}
#[derive(Serialize)]
struct Batch {
use erased_serde;
use serde_json;
#[derive(Serialize)]
struct Event {
data_point: usize
}
#[derive(Serialize)]
struct Batch {
@saarw
saarw / MultiSourceWindowCoGroupTest.java
Created November 22, 2016 22:02
MultiSourceWindowCoGroupTest
import org.apache.flink.api.common.functions.CoGroupFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.AssignerWithPunctuatedWatermarks;
import org.apache.flink.streaming.api.functions.windowing.WindowFunction;