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
| import re | |
| import argparse | |
| from collections import namedtuple | |
| class Record: | |
| def __init__(self, crtime=0.00000, ch=1, hexid=0x000, dir="Rx", stat="d", data=None, length=0, bitcount=0, decid=0): | |
| self.crtime = crtime | |
| self.ch = ch | |
| self.hexid = hexid |
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 com.fasterxml.jackson.dataformat.protobuf.schema; | |
| import com.fasterxml.jackson.databind.JsonNode; | |
| import com.fasterxml.jackson.dataformat.protobuf.ProtobufMapper; | |
| import com.fasterxml.jackson.dataformat.protobuf.ProtobufTestBase; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| public class DeserializeTest extends ProtobufTestBase |
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 com.fasterxml.jackson.dataformat.protobuf.schema; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import com.fasterxml.jackson.databind.ObjectWriter; | |
| import com.fasterxml.jackson.dataformat.protobuf.ProtobufFactory; | |
| import com.fasterxml.jackson.dataformat.protobuf.ProtobufTestBase; | |
| import java.io.IOException; | |
| import java.io.StringReader; |
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
| #!/bin/bash | |
| # submit a batch job to Druid that re-index for yesterday | |
| # Therefore, run this script after midnight UTC | |
| RANGE_FROM=$(date --date="yesterday" +%Y-%m-%d) | |
| RANGE_TO=$(date +%Y-%m-%d) | |
| curl -XPOST -H 'Content-Type: application/json' http://localhost:18090/druid/indexer/v1/task -d @- <<EOF | |
| { | |
| "type": "index_hadoop", |
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 com.example.jackson.protobuf; | |
| import com.fasterxml.jackson.dataformat.protobuf.schema.FieldType; | |
| import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufEnum; | |
| import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField; | |
| import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage; | |
| import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema; | |
| import com.github.os72.protobuf.dynamic.DynamicSchema; | |
| import com.google.protobuf.Descriptors; | |
| import com.squareup.protoparser.DataType; |
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 void testPacked() throws Exception | |
| { | |
| byte[] protobufData; | |
| final String SCHEMA_STR = | |
| "package mypackage;\n" | |
| + "message t1 {\n" | |
| + " repeated uint32 report_code = 1 [packed=true];\n" | |
| + "}"; |
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
| { | |
| "type": "kafka", | |
| "dataSchema": { | |
| "dataSource": "metrics-kafka", | |
| "parser": { | |
| "type": "protobuf", | |
| "descriptor": "file:///tmp/metricskafka.desc", | |
| "protoMessageType": "MetricsKafka", | |
| "parseSpec": { | |
| "format": "json", |
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
| $ diff -u example.py example_threaded.py | |
| --- example.py 2016-12-20 16:19:19.000000000 -0800 | |
| +++ example_threaded.py 2016-12-20 16:23:43.000000000 -0800 | |
| @@ -1,6 +1,13 @@ | |
| +import logging | |
| +import threading | |
| + | |
| from flask import request, url_for | |
| from flask.ext.api import FlaskAPI, status, exceptions |
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
| CONST | |
| m = 7, | |
| n = 85; | |
| VAR | |
| x, y, z, q, r; | |
| PROCEDURE multiply; | |
| VAR a, b; |
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', 'x', ',', 'squ', ';', 'PROCEDURE', 'square', ';', 'BEGIN', 'squ', ':=', 'x', '*', 'x', 'END', ';', 'BEGIN', 'x', ':=', '1', ';', 'WHILE', 'x', '<=', '10', 'DO', 'BEGIN', 'CALL', 'square', ';', 'x', ':=', 'x', '+', '1', ';', 'END', 'END', '.'] |