Skip to content

Instantly share code, notes, and snippets.

View fpopic's full-sized avatar
🌻
Have fun!

Filip Popić fpopic

🌻
Have fun!
View GitHub Profile
Cron Job legend:
~~~
* * * * * exec-cmd
┬ ┬ ┬ ┬ ┬
│ │ │ │ └───── day of week (0 - 7) (Sunday=0 or 7)
│ │ │ └────────── month (1 - 12)
│ │ └─────────────── day of month (1 - 31)
│ └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)
Tarif Monthly (expected 24 months) Once Total GB Router Monthly (SENDING FEE)
vodafone red internet & phone 50 20 * 12 + 35 * 12 20 680 homebox2 / FB 7430 24m free (0€ pickup)
vodafone red amadeus employee portal 10 * 12 + 35 * 12 50 590 homebox2 / FB 7430 24m free (0€ pickup)
1&1 50dsl 17 * 12 + 30 * 12 70 634 Modem 24m free (10€ sending)
1&1 50dsl young 15 * 12 + 30 * 12 70 610 Modem 24m free (10€ sending)
1&1 50dsl young no contract 15 * 12 + 30 * 12 70 610 dsl 149€ (10€ sending)
o2 50dsl young 24m/1m 10 * 03 + 15 * 09 + 35 * 12 585 300 own router
o2 50dsl amadeus 10 * 12 + 30 * 12 480 300 own router
@fpopic
fpopic / reduce.scala
Created March 18, 2018 22:47
Reduce and ReduceByKey in BEAM 2.3.0
import org.apache.beam.sdk.Pipeline
import org.apache.beam.sdk.transforms.Combine.BinaryCombineFn
import org.apache.beam.sdk.transforms.{Combine, Create, DoFn, MapElements}
import org.apache.beam.sdk.values.{KV, TypeDescriptors}
case class MyClass(int: Int)
class MyBinaryFn extends BinaryCombineFn[MyClass] {
def apply(left: MyClass, right: MyClass): MyClass = {
import java.util
import java.util.Calendar
import com.aerospike.client.admin.{Privilege, Role, User}
import com.aerospike.client.async.EventLoop
import com.aerospike.client.cluster.Node
import com.aerospike.client.listener._
import com.aerospike.client.policy._
import com.aerospike.client.query._
import com.aerospike.client.task.{ExecuteTask, IndexTask, RegisterTask}
/**
* This is a UDF of BigQuery legacy SPLIT statement.
*
* Parameters:
* col - column that you want to split
* del - delimiter to split by
*/
CREATE TEMPORARY FUNCTION STD_SPLIT(col STRING, del STRING)
RETURNS ARRAY<STRING>
LANGUAGE js AS """
package com.travelaudience.data.job.tracking
import TravelAudience.TrackingProto.TAF.taf.TAFEvent
import com.aerospike.client.{IAerospikeClient, Key, Record}
import org.apache.beam.sdk.transforms.DoFn.ProcessElement
import org.apache.beam.sdk.transforms.{DoFn, DoFnTester}
import org.scalatest.{FlatSpec, Matchers}
import scala.collection.JavaConverters._
import scala.util.{Failure, Success, Try}
import org.apache.beam.sdk.transforms.DoFn.ProcessElement
import org.apache.beam.sdk.transforms.{DoFn, DoFnTester}
import org.scalatest.{FlatSpec, Matchers}
class MyDoFn extends DoFn[Integer, Integer] {
@ProcessElement
def processElement(c: ProcessContext): Unit = {
c.output(c.element * 2)
}
import org.apache.beam.sdk.testing.{NeedsRunner, PAssert, TestPipeline}
import org.apache.beam.sdk.transforms.DoFn.ProcessElement
import org.apache.beam.sdk.transforms.{Create, DoFn, ParDo}
import org.junit.experimental.categories.Category
import org.junit.{Rule, Test}
import org.scalatest.junit.JUnitSuite
import scala.annotation.meta.getter
import scala.collection.JavaConverters._
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.