Skip to content

Instantly share code, notes, and snippets.

View tf0054's full-sized avatar

Takeshi Nakano tf0054

  • Curious Technology GmbH
  • Berlin, Germany
View GitHub Profile
package com.digipepper.test.kafka.consumer;
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import kafka.message.Message;
import kafka.javaapi.consumer.ConsumerConnector;
import kafka.api.OffsetRequest;
import java.nio.ByteBuffer;
@tf0054
tf0054 / json.xsl
Last active December 14, 2015 22:39
xslt v2.0 file for Solr (producing json data)
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!--
* Start solr with saxon(I am using saxon9-1-0-8j).
* these jars should be stored lib/ext/ (seen from the dir containing start.jar).
java -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl -jar start.jar
-->
<!--
* posted docs are like this.
@tf0054
tf0054 / GetContentsFromFbPage.java
Last active December 11, 2015 02:09
Java code for extracting contents from facebook page.
package com.digipepper.test.html;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.io.FileUtils;
<?xml version=\"1.0\" encoding=\"UTF-8\"?><config version=\"1.0\">
<collection type=\"ICA\">
<common>
<knownLanguage>ja<\/knownLanguage>
<timezone>Asia\/Tokyo<\/timezone>
<\/common>
<indexer>
<enableDateFacet>$.day<\/enableDateFacet>
<enableDateFacet>$.day_of_month<\/enableDateFacet>
<enableDateFacet>$.month<\/enableDateFacet>
@tf0054
tf0054 / pom.xml
Created November 18, 2012 15:47
jetty for static files and proxy for solr.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>hello-world</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Jetty HelloWorld</name>
@tf0054
tf0054 / kml.xml
Created November 15, 2012 17:25
solr-xslt file for making kml
<?xml version='1.0' encoding='UTF-8'?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@tf0054
tf0054 / build.sample.xml
Created September 27, 2012 04:35
how to check testatoo options
<project>
<!--
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile">
<mkdir dir="build/classes"/>
<javac srcdir="src" destdir="build/classes"/>
</target>
package org.hadoophacks.pig;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.FuncSpec;
import java.io.IOException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.logicalLayer.FrontendException;
@tf0054
tf0054 / ToTuple.java
Created March 22, 2012 14:54
Hack#48
package org.hadoophacks.pig;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.backend.executionengine.ExecException;
import java.io.IOException;
import org.apache.pig.data.TupleFactory;
import org.apache.pig.data.DataType;
import org.apache.pig.impl.logicalLayer.schema.Schema;
package org.hadoophacks.pig;
import org.apache.pig.StoreFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;
import org.apache.pig.data.DataByteArray;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.RecordWriter;