Skip to content

Instantly share code, notes, and snippets.

View jkpl's full-sized avatar

Jaakko Pallari jkpl

View GitHub Profile
jkpl / cdk-stack-deps-to-mermaid.js
Created January 15, 2024 12:56
CDK stack dependencies to Mermaid
#!/usr/bin/env node
Convert a CDK app manifest file to a stack dependency tree in Mermaid format.
const fs = require('fs');
function dependencyTreeInMermaid(data) {
const names = {};
const links = [];
jkpl / U.S. International wo dead keys.keylayout
Created March 9, 2022 07:00
U.S. International w/o dead keys keyboard layout for Mac
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Last edited by Ukelele version 2.0.1 on 2010-08-26 at 17:40 (GMT+02:00)-->
<keyboard group="0" id="2" name="U.S. International w/o dead keys" maxout="1">
<layout first="0" last="17" modifiers="f4" mapSet="16c"/>
<layout first="18" last="18" modifiers="f4" mapSet="994"/>
<layout first="21" last="23" modifiers="f4" mapSet="994"/>
<layout first="30" last="30" modifiers="f4" mapSet="994"/>
<layout first="194" last="194" modifiers="f4" mapSet="994"/>
param (
$script:regKeyPath = "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity"
If ($Disable) {
Write-Host "Disabling HyperV"
bcdedit /set hypervisorlaunchtype off
jkpl / ksql-app.yaml
Created May 7, 2020 14:10
Example KSQL app deployment for Kubernetes
apiVersion: v1
kind: Service
name: demo-ksql-server
app: demo-ksql-server
- port: 8088
jkpl / Dockerfile
Last active February 13, 2023 15:22
saml2aws Docker image
FROM debian:stable-slim
RUN apt-get update && \
apt-get install -y ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
RUN curl -L "$SAML2AWS_DOWNLOAD_URL" -o saml2aws.tar.gz && \
# This script deploys the given manifest,
# tracks the deployment, and rolls back on failure.
# First execute this with "myapp.yaml" and then try it with "myapp.failing.yaml"
jkpl / Main.scala
Created January 8, 2018 15:43
Dropwizard Graphite demo for Scala
package dwgraphitedemo
import java.util.concurrent.TimeUnit
import com.codahale.metrics.graphite.{Graphite, GraphiteReporter}
import com.codahale.metrics.SharedMetricRegistries
import com.codahale.metrics.jvm._
import com.twitter.finagle.http.{Request, Response, Status}
import com.twitter.finagle.{Http, Service}
jkpl /
Last active October 17, 2023 13:45
Error handling pitfalls in Scala

Error handling pitfalls in Scala

There are multiple strategies for error handling in Scala.

Errors can be represented as [exceptions][], which is a common way of dealing with errors in languages such as Java. However, exceptions are invisible to the type system, which can make them challenging to deal with. It's easy to leave out the necessary error handling, which can result in unfortunate runtime errors.

jkpl / altfin.keylayout
Created February 25, 2017 23:46
My old keyboard layout for OS X (Ukelele format)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Last edited by Ukelele version 2.2.4 on 2013-02-08 at 22:01 (UTC+2.00)-->
<keyboard group="0" id="5591" name="AltFin" maxout="1">
<layout first="0" last="17" modifiers="f4" mapSet="16c"/>
<layout first="18" last="18" modifiers="f4" mapSet="984"/>
<layout first="21" last="23" modifiers="f4" mapSet="984"/>
<layout first="30" last="30" modifiers="f4" mapSet="984"/>
<layout first="194" last="194" modifiers="f4" mapSet="984"/>
jkpl /
Created February 25, 2017 23:27
Convert CSV to KeepassX XML format
import sys
entry_t = """<entry>