Skip to content

Instantly share code, notes, and snippets.

Karl Roberts karlroberts

  • Sydney
Block or report user

Report or block karlroberts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@karlroberts
karlroberts / KarlDemoConcurrent.scala
Last active Jan 8, 2020
Show how to get some tasks in a cats.Effect IO to run concurrently with the other IO's in a for comprehension
View KarlDemoConcurrent.scala
/*
The code below has io1 io2 io3 that sleep for 2 seconds, 3 seconds and 2 seconds respectivly.
I sequence them in order in the for comprension but show how they can be context shifted onto other pools or
run concurrently in Fibers. the results are attched to this gist.
Note I use IOApp rather than App which automatically runs the run function to get the IO then calls runUnsafe on it
*/
package kfoo
import java.util.concurrent.Executors
@karlroberts
karlroberts / purconfig.bug
Last active Oct 22, 2019
Shows code where pureconfig 0.12.1 ConfigSource.resources(...) fails
View purconfig.bug
// when env = "dev"
// and I have a file called ./src/main/resources/application-dev.conf on my classpath
def forEnvironment(env: String): Configuration = {
val envSpecificConfigPath = "/application-" + env + ".conf"
val conf =
if (getClass.getResource(envSpecificConfigPath) != null &&
System.getProperty("config.resource") == null &&
System.getProperty("config.file") == null) {
View karl28082019crash.log
2019/08/28 17:09:18 [INFO] Terraform version: 0.12.6
2019/08/28 17:09:18 [INFO] Go runtime version: go1.12.4
2019/08/28 17:09:18 [INFO] CLI args: []string{"/usr/local/terraform/0.12.6/terraform", "plan"}
2019/08/28 17:09:18 [DEBUG] Attempting to open CLI config file: /home/robertk/.terraformrc
2019/08/28 17:09:18 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/08/28 17:09:18 [INFO] CLI command args: []string{"plan"}
2019/08/28 17:09:18 [TRACE] Meta.Backend: built configuration for "s3" backend with hash value 3758110317
2019/08/28 17:09:18 [TRACE] Preserving existing state lineage "6afd498b-1a91-c1a4-e20b-b257e7469445"
2019/08/28 17:09:18 [TRACE] Preserving existing state lineage "6afd498b-1a91-c1a4-e20b-b257e7469445"
2019/08/28 17:09:18 [TRACE] Meta.Backend: working directory was previously initialized for "s3" backend
@karlroberts
karlroberts / launch.sh
Created Mar 15, 2017
Hack to test speed of launching a sub process in node.js or python
View launch.sh
#!/bin/bash
#####
# Launch and time python and node scripts that also launch subprocesses
echo start launch python data subprocess...
date "+%T %s %N"
python mypydatesub.py
echo
echo start launch python compiled data subprocess...
date "+%T %s %N"
You can’t perform that action at this time.