Skip to content

Instantly share code, notes, and snippets.

View l15k4's full-sized avatar
🎯
Focusing

Jakub Liska l15k4

🎯
Focusing
View GitHub Profile
SELECT "c-geo:c3" AS "country", COUNT(DISTINCT "diid") AS "gwid", "d_site" AS "d_site"
FROM "test"
WHERE
("cid" = 'mjzrq2v' AND ("d_site" = '18975' OR "d_site" = '18969' OR "d_site" = '21034' OR "d_site" = '21032'
OR "d_site" = '21031' OR "d_site" = '21030' OR "d_site" = '18976' OR "d_site" = '20864' OR "d_site" = '19055'
OR "d_site" = '18620' OR "d_site" = '47404' OR "d_site" = '35936' OR "d_site" = '14210' OR "d_site" = '47403'
OR "d_site" = '43607' OR "d_site" = '36407' OR "d_site" = '36025' OR "d_site" = '34227' OR "d_site" = '15596'
OR "d_site" = '56098' OR "d_site" = '15298' OR "d_site" = '14209' OR "d_site" = '22631' OR "d_site" = '29508'
OR "d_site" = '13761' OR "d_site" = '22636' OR "d_site" = '22634' OR "d_site" = '31767' OR "d_site" = '31405'
OR "d_site" = '31495' OR "d_site" = '29222' OR "d_site" = '20933' OR "d_site" = '20164' OR "d_site" = '34271'

Keybase proof

I hereby claim:

  • I am l15k4 on github.
  • I am l15k4 (https://keybase.io/l15k4) on keybase.
  • I have a public key ASCZeVFczucfU88xvuPSmcLzDzyLXLxu9a8LhucF3HSUnAo

To claim this, I am signing this object:

Focus on solving real problems, not virtual problems

  • how wishful thinking works :
    • people tend to do what they like to do and they subconsciously rationalize terrible decisions :
      • let's introduce this foo, bar, baz hyping tech. cause everybody does that these days (it sounds fun)
        • ie. let's use FSM actor with akka persistence (it sounds fun) for a problem that in fact doesn't need any of that
    • use language and platform as a means of solving problems, not the other way around
  • when you live in a world of virtual problems because you subconsciously prefer to solve them over real problems that are not so pleasant to solve, then
    • you're gonna have x responsibilities more to care for with 0 business value unless you are a prodigy programmer
    • unless some business value can be spotted every week, you will end up feeling bad and probably discussing each of your steps with PM(s) whose presence is partially a reflection of your inability to focus on and
import akka.Done
import akka.stream.ActorMaterializer
import akka.stream.alpakka.s3.MemoryBufferType
import akka.stream.alpakka.s3.scaladsl.S3Client
import akka.stream.scaladsl.{Flow, JsonFraming}
import com.typesafe.scalalogging.{LazyLogging, StrictLogging}
import org.backuity.clist.util.Read
import org.backuity.clist.{CliMain, arg, opt}
import org.joda.time.Interval
import org.joda.time.chrono.ISOChronology
+---------------------------------------------------------------------------------------------------------------------------------------+
| gwiq-pipeline-p-etls-1 |
| |
| +----------------------+ +----------------------------------------------------------------------------------------------------------+ |
| | Pod : Head | | Pod : Tail | |
| | +------------------+ | | +------------------+ +------------------+ +------------------+ +------------------+ +------------------+ | |
| | | Group Backup | | | | Group Base | | Group Druid | | Group Overlap | | Group Panelists | | Group Overlap|V2 | | |
| | | +--------------+ | | | | +--------------+ | | +-----
#!/usr/bin/env bash
LOGS=$1
if ${LOGS} =~ .*DAG\ created.* && \
${LOGS} =~ .*Worker\ registered.*,backup\).* && \
${LOGS} =~ .*Worker\ registered.*,iasBackup\).* && \
${LOGS} =~ .*Worker\ registered.*iasBackup-iasBase.* && \
${LOGS} =~ .*Worker\ registered.*iasBase-iasScylla.* && \
${LOGS} =~ .*Worker\ registered.*backup-base.* && \
import com.twitter.chill._
object TwitterChillPlayGround extends App {
def serialize[T](t: T): Array[Byte] = ScalaKryoInstantiator.defaultPool.toBytesWithClass(t)
def deserialize[T](bytes: Array[Byte]): T = ScalaKryoInstantiator.defaultPool.fromBytes(bytes).asInstanceOf[T]
def roundTrip[T](t: T): T = deserialize(serialize(t))
require(Map("foo" -> "bar") == roundTrip(Map("foo" -> "bar")))
@l15k4
l15k4 / Router.scala
Last active February 10, 2017 14:08
class Router(routeeProps: Props, parallelism: Int) extends Actor with ActorLogging {
private def partitionCampaign(cid: String): Int = {
val rawMod = cid.hashCode % parallelism
rawMod + (if (rawMod < 0) parallelism else 0)
}
override def receive: Receive = initialized(ListMap.empty[Int, ActorRef])
def initialized(routees: Map[Int, ActorRef]): Receive = {
  1. User X registers to Panel Y => MirrorImage sets cookie gwid=xyz and logs it
  2. User X opts out on Panel Y => MirrorImage sets cookie gwid=OPTOUT and logs it with cid=c9999
  3. User X visits anything else => MirrorImage notices cookie gwid=OPTOUT and logs it

In other words, MirrorImage would use following logic :

if (optout-request)
  set gwid=OPTOUT
  log gwid=OPTOUT,cid=c9999
else if (gwid==OPTOUT) 
  1. User X registers to Panel Y => MirrorImage sets cookie gwid=xyz and logs it
  2. User X opts out on Panel Y => MirrorImage sets cookie gwid=OPTOUT and logs it with cid=c9999
  3. User X visits anything else => MirrorImage notices cookie gwid=OPTOUT and logs it

In other words, MirrorImage would use following logic :

if (optout-request)
  set gwid=OPTOUT
  log gwid=OPTOUT,cid=c9999
else if (gwid==OPTOUT)