Skip to content

Instantly share code, notes, and snippets.

View Pyppe's full-sized avatar

Pyry-Samuli Lahti Pyppe

View GitHub Profile
@Pyppe
Pyppe / Notes.md
Last active October 19, 2018 11:40

So we have a server running on localhost:8080.

  • Calling it with curl 'localhost:8080/foo/ping' works fine, and no timeouts are shown.
  • If I open the page in Chrome however, I get the response fine, but after timeout-threshold (2 sec in this example) the logs get a lot of errors:
    • EDIT: If I use Chrome's Incognito mode; no timeouts errors then
[info] java.util.concurrent.TimeoutException: Timeout of 2 seconds triggered. Killing pipeline.
[info] 	at org.http4s.blaze.pipeline.stages.TimeoutStageBase$$anon$1.run(TimeoutStageBase.scala:29)
[info] 	at org.http4s.blaze.util.Execution$$anon$3.execute(Execution.scala:66)
object Http4sBlazeServerBuilder {
case class Server(fiber: Fiber[IO, Nothing]) {
def shutdownNow(): Unit = fiber.cancel.unsafeRunSync()
}
type MappedService = (String, HttpRoutes[IO])
private implicit val cs = IO.contextShift(ExecutionContext.Implicits.global)
def startServer(port: Int,
@Pyppe
Pyppe / README.md
Last active May 23, 2020 08:55
Suomen kuntakartta 2017 GeoJSON

1. Load and transform TietoaKuntajaosta_2017_4500k.zip from kartat.kapsi.fi

wget "http://kartat.kapsi.fi/files/kuntajako/kuntajako_4500k/etrs89/shp/TietoaKuntajaosta_2017_4500k.zip"
unzip TietoaKuntajaosta_2017_4500k.zip
ogr2ogr -f GeoJSON -t_srs crs:84 SuomenKuntajako_2017_4500k.geo.json SuomenKuntajako_2017_4500k.shp

2. Transform and enhance GeoJSON

  • Added "maakunta" information from Wikipedia
@Pyppe
Pyppe / GithubUpstream.md
Created December 29, 2016 12:42
Configure Github upstream for forked repo
[
{
"id": "611004027",
"name": "Salla Vuorikoski",
"screenName": "svuorikoski",
"reactionCountByOthers": 6321,
"reactions": [
{
"id": "601907907",
"count": 165
@Pyppe
Pyppe / explain_for_pending_document.json
Created April 8, 2016 07:27
Boosting a field yields bizarre results Elasticsearch
{
"matched": true,
"explanation": {
"value": 2.1227224,
"description": "sum of:",
"details": [
{
"value": 2.1227224,
"description": "product of:",
"details": [
@Pyppe
Pyppe / Dockerfile
Last active February 11, 2016 08:43
Docker libreoffice as a DOCX to PDF conversion service
FROM ubuntu:14.04.3
MAINTAINER Pyppe
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y install software-properties-common
RUN add-apt-repository -y ppa:libreoffice/ppa
RUN apt-get -y update
RUN apt-get install -y libreoffice ttf-kochi-mincho
"pool-1-thread-4" #31 daemon prio=5 os_prio=0 tid=0x00007f3cb8014800 nid=0x377b waiting on condition [0x00007f3cff8f8000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000ec1cc150> (a java.util.concurrent.FutureTask)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
at java.util.concurrent.FutureTask.get(FutureTask.java:191)
at scalaz.concurrent.StrategysLow$$anon$3$$anonfun$apply$2.apply(Strategy.scala:81)
at scala.Function0$class.apply$mcZ$sp(Function0.scala:34)
object SlickEnumerationSupport {
def enumerationTypeName[V <: Enumeration.Value : ClassTag] = {
val valueSymbol = runtimeMirror.classSymbol(classTag[V].runtimeClass)
val valueTypeName = valueSymbol.name.decodedName.toString
val enumTypeName = valueSymbol.owner.name.decodedName.toString
// Always use public schema
s"${enumTypeName}_${valueTypeName}".toLowerCase
}
@Pyppe
Pyppe / example-tweet.json
Last active August 29, 2015 14:24
Elasticsearch terms aggregation issue
{
"created_at": "Tue May 12 21:04:07 +0000 2015",
"id": 598232209208832000,
"id_str": "598232209208832000",
"text": "Suomen @PinnallaFI-twiittidatan kiroilufrekvenssi kuvastaa melko hyvin #mmkisat-ratk.hetkiä\n#visualisointi #perkele http://t.co/VHurLxeHgg",
"source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,