Skip to content

Instantly share code, notes, and snippets.

@nicolaferraro
nicolaferraro / telegram-example.yaml
Created November 11, 2020 09:08
Telegram Example
---
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: example-telegram-source
spec:
source:
properties:
authorizationToken: put-here-your-token
@nicolaferraro
nicolaferraro / todo-swagger.json
Created September 5, 2018 12:17
Todo Swagger
---
swagger: "2.0"
info:
title: "Todo App API"
description: "Example Todo Application API"
version: "1.0.0"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "hostname"
@nicolaferraro
nicolaferraro / TryMapJava.java
Created September 4, 2016 09:55
Spark try-map functionality for Java
package it.test;
import java.io.Serializable;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.spark.Accumulator;
@nicolaferraro
nicolaferraro / stop-words.txt
Created May 7, 2015 14:02
English stopwords
a
about
above
across
after
afterwards
again
against
all
almost
def setStreamingLogLevels() {
val log4jInitialized = Logger.getRootLogger.getAllAppenders.hasMoreElements
if (!log4jInitialized) {
// We first log something to initialize Spark's default logging, then we override the
// logging level.
logInfo("Setting log level to [WARN] for streaming example." +
" To override add a custom log4j.properties to the classpath.")
Logger.getRootLogger.setLevel(Level.WARN)
}
}
@nicolaferraro
nicolaferraro / hbase pom.xml
Created May 6, 2015 15:56
Pom Hbase Spark
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.eng.spark</groupId>
<artifactId>spark-streaming</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
log4j.rootLogger=INFO, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.eng.hbase</groupId>
<artifactId>hbase-connect</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>hbase-connect</name>
You can use a dockerized version if you want just to try the shell. Just type:
docker run -it -p 2181:2181 -p 60000:60000 -p 60010:60010 -p 60020:60020 -p 60030:60030 -h hbase nerdammer/hbase-shell
Then add “hbase” to your “/etc/hosts” file and point it to boot2docker (192.168.59.103) address.
If you want to install it:
Download: http://archive.eu.apache.org/dist/hbase/hbase-1.0.0/hbase-1.0.0-bin.tar.gz
Untar
Run: bin/start-hbase.sh
For the shell: bin/hbase shell
If you want to install it on Windows:
package it.eng.scala.crawl
import org.jsoup.Jsoup
import scala.collection.JavaConversions._
object CrawlerService {
val AbsolutePrefix = "http://en.wikipedia.org/wiki/"
val RelativePrefix = "/wiki/"
val AbsolutePath = "http://en.wikipedia.org"