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
# ----------- | |
# 1. Download Raspberry Pi OS 64-bit image from https://www.raspberrypi.com/software/operating-systems | |
# (2023-02-21-raspios-bullseye-arm64-lite.img) | |
# ----------- | |
# 2. Use a copy of it as an sdcard image for QEMU. It needs to be sized as a power of two to be accepted. | |
cp 2023-02-21-raspios-bullseye-arm64-lite.img sdcard.img | |
qemu-img resize -f raw sdcard.img 4G | |
# qemu-img convert -f raw -O qcow2 2023-02-21-raspios-bullseye-arm64-lite.img sdcard.qcow2 |
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
-------------------- | |
label start | |
push 1 1 | |
push 2 1 2 | |
subtract -1 | |
in -1 n | |
duplicate -1 n k |
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 pureconfig._ | |
import pureconfig.generic.auto._ | |
object Util { | |
def myImplicitly[A](implicit a: A): A = a | |
def exec(f: => Unit): Unit = f | |
} | |
import Util._ |
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 core._ | |
case class InnerConf(n: Int, str: String) | |
object InnerConf { | |
implicit val innerConfReader: ConfigReader[InnerConf] = { _ => InnerConf(42, "custom") } | |
} | |
case class OuterConf(k: Int, inners: List[InnerConf]) |
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
scalaVersion := "2.10.7" | |
libraryDependencies ++= Seq( | |
"com.chuusai" %% "shapeless" % "2.3.3", | |
compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)) | |
scalacOptions += "-language:experimental.macros" |
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 os | |
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.optimizers import Adam | |
from common.gym_runner import GymRunner | |
from common.q_learning_agent import QLearningAgent | |
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 os | |
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.optimizers import Adam | |
from common.gym_runner import GymRunner | |
from common.q_learning_agent import QLearningAgent | |
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
trait Mat[A] | |
object Mat { | |
def materializeMatImpl[A](c: whitebox.Context)(implicit tt: c.WeakTypeTag[A]): c.Tree = { | |
import c.universe._ | |
println(s"At ${weakTypeOf[A]} (${c.openImplicits.length})") | |
c.inferImplicitValue(weakTypeOf[A]) match { | |
case EmptyTree => c.abort(c.enclosingPosition, "fail") | |
case _ => q"new Mat[${weakTypeOf[A]}] {}" |
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 scala.language.experimental.macros | |
import scala.reflect.macros.blackbox | |
trait Derivation[A] { | |
def value: A | |
} | |
object Derivation { | |
case class Successful[A](value: A) extends Derivation[A] |
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
object Test { | |
trait MyTrait { type Out[_] } | |
object MyInstance extends MyTrait { type Out[A] = A } | |
implicit class RichMyTrait[Out0[_]](myStuff: MyTrait { type Out[A] = Out0[A] }) { | |
def f[A]: Out0[A] = ??? | |
} | |
MyInstance.f[String] |
NewerOlder