Skip to content

Instantly share code, notes, and snippets.

:octocat:
Crunching numbers...

ioleo ioleo

:octocat:
Crunching numbers...
Block or report user

Report or block ioleo

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
@ioleo
ioleo / qvm-portfwd-iptables
Created Dec 12, 2018 — forked from Joeviocoe/qvm-portfwd-iptables
Qubes-os port forwarding to allow external connections
View qvm-portfwd-iptables
#!/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 Sep 18, 2018
Scalaz Zio Schedule test
View ZioScheduleTest.scala
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 / adapters.application.js
Last active Aug 12, 2018
Ember Data store problem
View adapters.application.js
import DS from 'ember-data';
let ApplicationAdapter = DS.RESTAdapter.extend({
namespace: 'api',
});
export default ApplicationAdapter;
View keybase.md

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 / CombiningTaglessHandlers.scala
Last active Jan 23, 2019
Example of free tagless combined handlers for module
View CombiningTaglessHandlers.scala
import cats.data.IdT
import cats.{~>, Id, Monad}
import freestyle.tagless.logging.LoggingM
import freestyle.tagless._
import sourcecode.{File, Line}
@tagless trait Summer {
def sum(a: Int, b: Int): FS[Int]
}
@ioleo
ioleo / ConfigReader.scala
Created Jan 29, 2018
Classy typesafe config reader utils
View ConfigReader.scala
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 {
@ioleo
ioleo / FreeModulesExample.scala
Last active Jan 23, 2019
Freestyle free program example with multiple algebras composed into module
View FreeModulesExample.scala
import cats.effect.IO
import freestyle.free._
import freestyle.free.implicits._
@free trait Logger {
def debug(message: String): FS[Unit]
}
@free trait Summer {
def sum(a: Int, b: Int): FS[Int]
@ioleo
ioleo / TaglessModulesExample.scala
Last active Jan 23, 2019
Freestyle tagless program example with multiple algebras composed into module
View TaglessModulesExample.scala
import cats.Monad
import cats.effect.IO
import freestyle.tagless._
@tagless trait Logger {
def debug(message: String): FS[Unit]
}
@tagless trait Summer {
def sum(a: Int, b: Int): FS[Int]
@ioleo
ioleo / GenericFreeAlgebra.scala
Last active Jan 23, 2019
Example of generic free algebra with Cats and Freestyle. Additional type args beyond F[_] in algebras are not currently supported. To work around we use path dependent types.
View GenericFreeAlgebra.scala
import cats.data.State
import freestyle.free._
/* domain objects */
sealed trait Acme
object Acme {
case object AcmeUK extends Acme
case object AcmeUS extends Acme
}
@ioleo
ioleo / SimpleFreestyleTagless.scala
Created Jan 26, 2018
Simple freestyle tagless program example with single instruction
View SimpleFreestyleTagless.scala
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]
You can’t perform that action at this time.