This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- ** setting up example tables and data ** | |
-- | |
-- | |
CREATE TABLE task ( | |
id BIGSERIAL , | |
name TEXT, | |
parent_id BIGINT REFERENCES task(id), | |
PRIMARY KEY (id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.implicits._ | |
import cats.effect.{ConcurrentEffect, Effect, ExitCode, IO, IOApp, Timer} | |
import fs2._ | |
import fs2.concurrent.Queue | |
import scala.concurrent.duration._ | |
import scala.concurrent.duration.MILLISECONDS | |
// | |
// fs2 example code from | |
// https://underscore.io/blog/posts/2018/03/20/fs2.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.practicingtechie | |
// implement AEAD with AES + GCM | |
object AeadHelper { | |
import javax.crypto._ | |
import javax.crypto.spec.{GCMParameterSpec, SecretKeySpec} | |
import java.security._ | |
import java.util.Base64 | |
val AesKeySize = 256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
adapted from: | |
https://github.com/monix/monix/blob/4f1862c4bcad7d111aa8cf64510c2fc5dcee6b77/monix-catnap/shared/src/main/scala/monix/catnap/FutureLift.scala | |
Monix dependency removed. | |
*/ | |
package async { | |
import cats.effect.Async | |
import scala.concurrent.Future | |
import scala.language.higherKinds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object effect { | |
import cats.effect.IO | |
import scala.concurrent.Future | |
import language.implicitConversions | |
import language.higherKinds | |
import scala.util.{Success, Failure} | |
import scala.concurrent.Promise | |
import cats.effect.Effect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========== approach 1 ========== | |
sealed abstract class FooBase { | |
def subType: String = this.getClass.getSimpleName | |
} | |
case class Foo(a: Int, b: String) extends FooBase | |
case class Bar(c: Float, d: Int) extends FooBase | |
val fooName = getClassName(Foo.getClass) | |
val barName = getClassName(Bar.getClass) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
from keras.models import Sequential | |
import h5py | |
from keras.utils.io_utils import HDF5Matrix | |
data_dir = '...' | |
train_fn = data_dir + '/dataset_train.h5' | |
test_fn = data_dir + '/dataset_test.h5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# requires CA.pl from OpenSSL: https://github.com/openssl/openssl/blob/master/apps/CA.pl.in | |
# | |
# generating CA.pl from OpenSSL source: | |
# /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \ | |
# "-oMakefile" apps/CA.pl.in > "apps/CA.pl" | |
# sudo cp apps/CA.pl /usr/local/bin | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.practicingtechie | |
import org.apache.activemq.artemis.api.core.TransportConfiguration | |
import org.apache.activemq.artemis.api.core.SimpleString | |
import org.apache.activemq.artemis.api.core.client.{ActiveMQClient, ClientMessage, MessageHandler} | |
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants._ | |
import scala.collection.JavaConversions._ | |
// produce & consume messages using Apache Artemis v2.2.0 core API | |
object ArtemisClient { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.link { | |
stroke: #aaa; | |
} | |
.node { | |
pointer-events: all; |
NewerOlder