Skip to content

Instantly share code, notes, and snippets.

package ru.sber
import org.apache.spark.sql.SparkSession
object SimpleApp {
def main(args: Array[String]) {
val spark = SparkSession.builder.master("local").getOrCreate()
import spark.implicits._
Seq(
@wiikviz
wiikviz / test.scala
Created November 26, 2019 15:54
Test
package ru.sber
import org.apache.spark.sql.SparkSession
object SimpleApp {
def main(args: Array[String]) {
val spark = SparkSession.builder.master("local").getOrCreate()
import spark.implicits._
Seq(
@wiikviz
wiikviz / npm-upgrade-bleeding.sh
Created February 28, 2017 12:48 — forked from othiym23/npm-upgrade-bleeding.sh
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
@wiikviz
wiikviz / gist:33f58be4ef736b4cb85856d8c6ea56d8
Created December 4, 2016 22:19 — forked from etorreborre/gist:1371518
Tagged Epochtime and Daytime
package object time {
// Unboxed newtypes, credit to @milessabin and @retronym
type Tagged[U] = { type Tag = U }
type @@[T, U] = T with Tagged[U]
class Tagger[U] { def apply[T](t : T) : T @@ U = t.asInstanceOf[T @@ U] }
def tag[U] = new Tagger[U]
trait Day
@wiikviz
wiikviz / HashMapBenchmark.java
Created December 4, 2016 21:07 — forked from duarten/HashMapBenchmark.java
Concurrent maps benchmarks
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import scala.collection.concurrent.TrieMap;
import org.openjdk.jmh.annotations.*;
@BenchmarkMode(Mode.AverageTime)
@wiikviz
wiikviz / LeftOuterJoinExample.java
Created July 11, 2016 13:27 — forked from mxm/LeftOuterJoinExample.java
Example for a LEFT OUTER JOIN in Apache Flink
package org.myorg.quickstart;
import org.apache.flink.api.common.functions.CoGroupFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.util.Collector;
@wiikviz
wiikviz / FinishingCountTrigger.java
Created July 7, 2016 17:08 — forked from krolen/FinishingCountTrigger.java
Flink - counting trigger that correctly flushes all windows
public class FinishingCountTrigger<W extends Window> extends Trigger<Object, W> {
private static final long serialVersionUID = 1L;
private final long maxCount;
private final ValueStateDescriptor<Long> stateDesc = new ValueStateDescriptor<>("count", LongSerializer.INSTANCE, 0L);
public FinishingCountTrigger(long maxCount) {
this.maxCount = maxCount;
}
@wiikviz
wiikviz / DistinctCountTest.scala
Created July 7, 2016 17:07 — forked from ogibayashi/DistinctCountTest.scala
Distinct count test code for Apache Flink
import java.sql.Timestamp
import java.util.concurrent.TimeUnit
import org.apache.flink.streaming.api.functions.source.FileMonitoringFunction
import org.apache.flink.streaming.api.functions.source.FileMonitoringFunction.{ WatchType}
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.time.Time
import org.apache.flink.streaming.api.windowing.triggers.ContinuousProcessingTimeTrigger
object DistinctCountTest {
@wiikviz
wiikviz / HBaseOutputFormat.scala
Created July 7, 2016 17:06 — forked from joroKr21/HBaseOutputFormat.scala
HBase OutputFormat for Apache Flink
import org.apache.flink.api.common.io.OutputFormat
import org.apache.flink.configuration.Configuration
import org.apache.hadoop.hbase._
import client._
import util.Bytes
import language.{ implicitConversions, reflectiveCalls }
import java.math.BigDecimal
import java.nio.ByteBuffer
@wiikviz
wiikviz / Nutch - pom.xml
Created November 11, 2015 13:54 — forked from sim51/Nutch - pom.xml
Maven pom.xml for a nutch project, that do an overlay on the nutch source zip file.
<?xml version="1.0" encoding="UTF-8"?>
<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>
<packaging>pom</packaging>
<!-- =========== -->
<!-- = General = -->
<!-- =========== -->
<groupId>com.logisima.search</groupId>
<artifactId>crawler</artifactId>