Skip to content

Instantly share code, notes, and snippets.

View chuwy's full-sized avatar

Anton Parkhomenko chuwy

View GitHub Profile
@chuwy
chuwy / BreakReferentialTransparency.scala
Created March 1, 2018 11:48
Interleaving lazy and eager evaluation to break referential transparency
import cats._
import cats.implicits._
import cats.effect._
import cats.effect.implicits._
object Db {
private val cache = collection.mutable.Map.empty[String, String]
def expensiveIO(input: String): IO[String] =
IO { Thread.sleep(1000); println("Executed expensive action"); input ++ input }
@chuwy
chuwy / diff_hosted_repo.txt
Created February 12, 2018 09:01
diff -r hosted repo
Only in hosted: com.admo-analytics
Only in hosted: com.adxtracking
Only in hosted: com.angelrush
Only in hosted: com.calltracks
Only in hosted: com.certivox
Only in repo: com.convertro
Only in hosted: com.duproprio
Only in hosted: com.duproprio_comfree
Only in hosted: com.findly
Only in hosted: com.finerylondon

Keybase proof

I hereby claim:

  • I am chuwy on github.
  • I am chuwy (https://keybase.io/chuwy) on keybase.
  • I have a public key ASC4yihj3aD9BK2glw6wm-sUNqbq9Qj8uWYJMcb3KhGjrQo

To claim this, I am signing this object:

@chuwy
chuwy / Validator.scala
Created February 23, 2017 12:57
Json Schema Validator
package jsonschemavalidator
import scala.language.implicitConversions
import cats.syntax.either._
import cats.syntax.semigroup._
import cats.syntax.semigroupk._
import cats.syntax.validated._
import cats.data.ValidatedNel
import cats.instances.all._
@chuwy
chuwy / interval.scala
Created February 4, 2017 21:26
Simple FS2 interval implementation
import fs2._
import scala.concurrent.duration._
/**
* Stream of signals with pauses
*/
object Interval {
private implicit val strategy = Strategy.fromFixedDaemonPool(3)
private implicit val scheduler = Scheduler.fromFixedDaemonPool(3)
@chuwy
chuwy / webserver.py
Last active April 4, 2016 11:49
Webserver printing headers
#!/usr/bin/env python
"""
Webserver printing headers
"""
import SimpleHTTPServer
import SocketServer
import logging
import sys
@chuwy
chuwy / issuer.py
Last active March 1, 2016 06:25
Script for looking unmentioned commits
#!/usr/bin/env python3
"""
Script for looking unmentioned commits in milesone comparing with specified PR
Usage: issuer.py user password company/repository milestone_pattern pull_id
"""
import sys
import itertools
import re
1450880573740
1450880574145
1450880574470
1450880574796
java.util.concurrent.TimeoutException: Futures timed out after [3 seconds]
1450880577800
java.util.concurrent.TimeoutException: Futures timed out after [3 seconds]
1450880580803
java.util.concurrent.TimeoutException: Futures timed out after [3 seconds]
1450880583807
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{ Sink, Source, Flow }
import com.typesafe.config.ConfigFactory
import scala.concurrent.{ Future, Await, ExecutionContext }
import scala.concurrent.duration._
@chuwy
chuwy / gist:0c833dd01fe2ab40f9ce
Created November 19, 2015 10:06
response.scala
final case class WeatherStamp(main: MainInfo, wind: Wind, clouds: Clouds, rain: Option[Rain], snow: Option[Snow], dt: BigInt) extends OwmResponse
// Common `main` JSON object
case class MainInfo(
grndLevel: Option[BigDecimal],
humidity: BigInt,
pressure: BigDecimal,
seaLevel: Option[BigDecimal],
temp: BigDecimal,
tempMin: BigDecimal,