Skip to content

Instantly share code, notes, and snippets.

View ioleo's full-sized avatar
🌊
Fighting the tide...

ioleo ioleo

🌊
Fighting the tide...
View GitHub Profile
#!/bin/bash
# Custom scripts here
echo "This is an extended entrypoint!"
# Run the original entrypoint located at
# /docker-entrypoint.sh
exec /docker-entrypoint.sh "$@"
@ioleo
ioleo / ArbitraryFreestyleFree.scala
Created January 26, 2018 12:13
Arbitrary freestyle free program example with multiple instructions
import cats.data.State
import freestyle.free._
/* domain objects */
case class Id(id: String)
case class AcmeItem(id: Id)
/* state */
trait MapState[K, V] {
@ioleo
ioleo / SimpleFreestyleFree.scala
Last active January 26, 2018 12:13
Simple freestyle free program example with single instruction
import cats.data.State
import freestyle.free._
/* domain objects */
case class Id(id: String)
case class AcmeItem(id: Id)
/* state */
trait MapState[K, V] {
@ioleo
ioleo / ArbitraryFreestyleTagless.scala
Created January 26, 2018 12:17
Arbitrary freestyle tagless program example with multiple instructions
import cats.data.State
import freestyle.tagless._
/* domain objects */
case class Id(id: String)
case class AcmeItem(id: Id)
/* state */
trait MapState[K, V] {
type Type = Map[K, V]
@ioleo
ioleo / GenericTaglessAlgebra.scala
Last active February 12, 2018 20:17
Example of generic tagless algebra with Cats and Freestyle. Additional type args beyond F[_] in algebras are not currently supported. To work around we use path dependent types.
import cats.data.State
import freestyle.tagless._
/* domain objects */
sealed trait Acme
object Acme {
case object AcmeUK extends Acme
case object AcmeUS extends Acme
}

Keybase proof

I hereby claim:

  • I am ioleo on github.
  • I am ioleo (https://keybase.io/ioleo) on keybase.
  • I have a public key whose fingerprint is F3AE 8A39 46C3 A728 F7E9 67AE 574C 46F6 3AE4 DEBF

To claim this, I am signing this object:

@ioleo
ioleo / adapters.application.js
Last active August 12, 2018 19:40
Ember Data store problem
import DS from 'ember-data';
let ApplicationAdapter = DS.RESTAdapter.extend({
namespace: 'api',
});
export default ApplicationAdapter;
@ioleo
ioleo / qvm-portfwd-iptables
Created December 12, 2018 15:53 — forked from Joeviocoe/qvm-portfwd-iptables
Qubes-os port forwarding to allow external connections
#!/bin/sh
# Inspired by https://gist.github.com/daktak/f887352d564b54f9e529404cc0eb60d5
# Inspired by https://gist.github.com/jpouellet/d8cd0eb8589a5b9bf0c53a28fc530369
ip() { qvm-prefs -g -- "$1" ip; }
netvm() { qvm-prefs -g -- "$1" netvm; }
forward() {
local from_domain=$1
local to_domain=$2
@ioleo
ioleo / ZioScheduleTest.scala
Created September 18, 2018 07:21
Scalaz Zio Schedule test
import scalaz.zio._
import scalaz.zio.interop.future._
import scala.concurrent.{ ExecutionContext, Future }
import scala.concurrent.duration._
object ZioScheduleTest extends App {
var counter = 0
def futureF(): Future[Int] = {
@ioleo
ioleo / ConfigReader.scala
Created January 29, 2018 20:08
Classy typesafe config reader utils
import classy.{DecodeError, Read}
import classy.config.ConfigDecoder
import com.typesafe.config.Config
import scala.util.{Failure, Success, Try}
object ConfigReader {
def apply[A](f: String => A): Read[Config, A] = { path =>
ConfigDecoder.instance[A] { config =>
Try(f(config.getString(path))) match {