Skip to content

Instantly share code, notes, and snippets.

View barambani's full-sized avatar

Filippo Mariotti barambani

View GitHub Profile
@barambani
barambani / basictex-install.sh
Created May 30, 2023 13:31 — forked from muzimuzhi/basictex-install.sh
install and config basicTeX
##
# A script to help you install and config basictex
# https://www.tug.org/mactex/morepackages.html
#
# References:
# - https://gist.github.com/kadrach/6228314
# - https://tex.stackexchange.com/a/304202
#
# Requirements:
# - homebrew
@barambani
barambani / install_xelatex_on_mac.txt
Created December 3, 2022 12:25 — forked from peterhurford/install_xelatex_on_mac.txt
How to install latex and xelatex on Mac so that Jupyter "Download as PDF" will work
brew install pandoc
brew tap homebrew/cask
brew install --cask basictex
eval "$(/usr/libexec/path_helper)"
# Update $PATH to include `/usr/local/texlive/2022basic/bin/universal-darwin`
sudo tlmgr update --self
sudo tlmgr install texliveonfly
sudo tlmgr install xelatex
sudo tlmgr install adjustbox
sudo tlmgr install tcolorbox
java.lang.AssertionError: assertion failed:
numeric$PosByte
while compiling: /Users/fmariotti/open-src/laserdisc/core/src/main/scala/laserdisc/types.scala
during phase: globalPhase=terminal, enteringPhase=xsbt-analyzer
library version: version 2.13.0
compiler version: version 2.13.0
reconstructed args: -Xcheckinit -Xplugin:/Users/fmariotti/.coursier/cache/v1/https/repo1.maven.org/maven2/org/typelevel/kind-projector_2.13/0.10.3/kind-projector_2.13-0.10.3.jar -Xplugin:/Users/fmariotti/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scoverage/scalac-scoverage-plugin_2.13/1.4.0/scalac-scoverage-plugin_2.13-1.4.0.jar -deprecation -P:scoverage:dataDir:/Users/fmariotti/open-src/laserdisc/core/.jvm/target/scala-2.13/scoverage-data -Wnumeric-widen -feature -bootclasspath /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Con
[info] Compiling 1 Scala source to /Users/fmariotti/open-src/laserdisc/circe/.js/target/scala-2.12/test-classes ...
java.lang.AssertionError: assertion failed:
char$LowerCaseChar
while compiling: /Users/fmariotti/open-src/laserdisc/core/src/main/scala/laserdisc/types.scala
during phase: globalPhase=terminal, enteringPhase=xsbt-analyzer
library version: version 2.12.8
compiler version: version 2.12.8
reconstructed args: -Ywarn-value-discard -Ywarn-nullary-unit -feature -Ywarn-inaccessible -Ypartial-unification -Xcheckinit -Xlint:adapted-args -Xlint:nullary-unit -Xlint:inaccessible -Xlint:nullary-override -Xlint:infer-any -Xlint:missing-interpolator -Xlint:doc-detached -Xlint:private-shadow -Xlint:type-parameter-shadow -Xlint:poly-implicit-overload -Xlint:option-implicit -Xlint:delayedinit-select -Xlint:by-name-right-associative -Xlint:package-object-classes -Xlint:unsound-match -Xlint:stars-align -Xlint:constant -Ywarn-unused:imports -Ywarn-unused:patvars -Ywarn-unused:privates -Ywarn
@barambani
barambani / listt.scala
Created January 9, 2019 21:31 — forked from tpolecat/listt.scala
A demonstration in Scala of failed associativity of ListT. Example taken from https://wiki.haskell.org/ListT_done_right
// addCompilerPlugin("com.milessabin" % "si2712fix-plugin" % "1.2.0" cross CrossVersion.full)
import scalaz._, Scalaz._
implicit def f2k[F[_], A, B](f: A => F[B]) = Kleisli(f)
val a: Int => ListT[List, Int] = {
case 0 => ListT(List(List(0, 1)))
case 1 => ListT(List(List(0), List(1)))
}
@barambani
barambani / GADTs.scala
Created December 1, 2018 15:22 — forked from pchiusano/GADTs.scala
GADT support in Scala
/** GADTs in Scala and their limitations */
/** Background: what is an algebraic data type (ADT) ?
* ADT: (possibly) recursive datatype with sums and products
* In scala - a trait with case classes (case class is product, subtyping is sum)
*/
/** Motivation: untyped embedded DSL doesn't prevent nonsensical expressions */
sealed trait Expr {
def apply(other: Expr) = Ap(this, other)
@barambani
barambani / fs2.scala
Created October 14, 2018 23:17 — forked from smarter/fs2.scala
trait Stream[+F[_], +A]
object Stream {
// Make scalac get over its oudenophobia.
type Nothing2[X] <: Nothing
def emits[F[x] >: Nothing2[x], A](as: List[A]): Stream[F, A] = new Stream[F, A] {}
implicit class InvariantOps[F[x] >: Nothing2[x], A](private val self: Stream[F, A]) extends AnyVal {
def ethrough[B](p: Stream[F, A] => Stream[F, B]): Stream[F, B] = p(self)
@barambani
barambani / LocalTests.scala
Created October 6, 2018 18:26 — forked from milessabin/LocalTests.scala
Setup for local integration (ie. compile pos/neg/run) tests for lampepfl/dotty
// local/localtests/test/localtests/LocalTests.scala
package localtests
import java.nio.file._
import java.util.stream.{ Stream => JStream }
import org.junit.{ AfterClass, Test }
import scala.collection.JavaConverters._
import scala.concurrent.duration._
@barambani
barambani / typelevelcps.scala
Created August 27, 2018 12:45 — forked from milessabin/typelevelcps.scala
Using type level continuation passing style to rewrite a whitebox macro (which relies on fundep materialization) as a blackbox macro
import scala.language.higherKinds
// Whitebox ...
trait Schema[T, R] {
def conv(t: T): R
}
object Schema {
// Whitebox macro: R is computed from T
implicit def mkSchema[T, R]: Schema[T, R] = ??? // macro ...
@barambani
barambani / fpmax.scala
Created July 15, 2018 13:29 — forked from jdegoes/fpmax.scala
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()