This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws Exception { | |
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); | |
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); | |
env.enableCheckpointing(TimeUnit.MINUTES.toMillis(1), CheckpointingMode.EXACTLY_ONCE); | |
env.setStateBackend(new FsStateBackend("hdfs://<server><dir>/checkpoints",true)); | |
env.getCheckpointConfig().setTolerableCheckpointFailureNumber(1); | |
StreamingFileSink<JsonObject> hdfsSink = StreamingFileSink | |
.<JsonObject>forRowFormat(new Path("hdfs://<server>/<dir>"), new SimpleStringEncoder<>("UTF-8")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package se.flapsdown.micrometer.bugs; | |
import io.micrometer.core.instrument.Clock; | |
import io.micrometer.core.instrument.Meter; | |
import io.micrometer.core.instrument.Timer; | |
import io.micrometer.core.instrument.step.StepMeterRegistry; | |
import io.micrometer.core.instrument.step.StepRegistryConfig; | |
import java.time.Duration; | |
import java.util.Random; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package se.flapsdown.micrometer.histograms.bug; | |
import io.micrometer.core.instrument.Clock; | |
import io.micrometer.core.instrument.Meter; | |
import io.micrometer.core.instrument.Timer; | |
import io.micrometer.core.instrument.distribution.CountAtBucket; | |
import io.micrometer.core.instrument.distribution.HistogramSnapshot; | |
import io.micrometer.core.instrument.step.StepMeterRegistry; | |
import io.micrometer.core.instrument.step.StepRegistryConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lumbermill | |
import lumbermill.api.Codecs | |
import rx.Observable | |
import static lumbermill.Core.* | |
// Simply replace with correct contents and play around | |
Observable.just(Codecs.TEXT_TO_JSON.from('Hello World')) | |
.flatMap ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kinesis = require('kinesis') | |
var stream = require('stream') | |
var crypto = require('crypto') | |
// Make sure to set your AWS_PROFILE / AWS_DEFAULT_PROFILE unless you run IAM | |
var options = { | |
region: 'eu-west-1', | |
name: 'streamName' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongodb.request.get({ | |
baseUri:'http://localhost:8000', | |
database:'demo', | |
collection:'demo', | |
method:'_find', | |
criteria:{name:'johan'}, | |
sort:{age:mongodb.sort.ASC}, | |
user:'demo', | |
passwd:'demo123', | |
error:function (data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic-auth validation and url (database) access validation | |
function authenticate(req, res, callback) { | |
// Extract authorization header and decode | |
var header = req.headers['authorization'] || '', // get the header | |
token = header.split(/\s+/).pop() || '', // and the encoded auth token | |
auth = new Buffer(token, 'base64').toString(), // convert from base64 | |
parts = auth.split(/:/), // split on colon | |
user = parts[0], | |
passwd = parts[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handleCors(req, res, callback) { | |
res.setHeader('Access-Control-Allow-Origin', '*') | |
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE,OPTIONS'); | |
res.setHeader('Access-Control-Allow-Headers', 'Authorization'); | |
// CORS OPTIONS request, simply return 200 | |
if (req.method == 'OPTIONS') { | |
res.statusCode = 200; | |
res.end(); |