Skip to content

Instantly share code, notes, and snippets.

View karlroberts's full-sized avatar

Karl Roberts karlroberts

View GitHub Profile
@karlroberts
karlroberts / KarlDemoConcurrent.scala
Last active January 8, 2020 04:18
Show how to get some tasks in a cats.Effect IO to run concurrently with the other IO's in a for comprehension
/*
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 October 22, 2019 22:54
Shows code where pureconfig 0.12.1 ConfigSource.resources(...) fails
// 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) {
@karlroberts
karlroberts / karl28082019crash.log
Created August 28, 2019 07:32
terraform crash
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 March 15, 2017 01:45
Hack to test speed of launching a sub process in node.js or python
#!/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"