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
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE OverlappingInstances #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE TupleSections #-} | |
{- | |
Parsing the output of the xrandr command. For example: | |
$> xrandr | |
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767 |
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 -eu | |
# | |
# Set up a sbt project. This script requires sbt and bash :). | |
# | |
# usage: | |
# - mkdir <project_name> | |
# - cd <project_name> | |
# - ./<this_script_dir>/init_sbt_project.sh | |
# | |
# author: Mario Pastorelli <pastorelli.mario@gmail.com> |
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 csvShapeless | |
import shapeless._, labelled.{ field, FieldType }, syntax.singleton._ | |
import scala.util.{Try,Success,Failure} | |
case class Person(name: String, surname: String, age: Int) | |
object Main extends App { |
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.data.Xor | |
import io.circe._ | |
sealed abstract class Predicate extends Product with Serializable | |
final case class Equal(int: Int) extends Predicate | |
final case class Bigger(int: Int) extends Predicate | |
case class Foo(opt: Option[Predicate]) |
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
class HasN a where | |
n :: a -> Int | |
data JobOne = JobOne Int | |
data JobTwo = JobTwo | |
data JobThree = JobThree Int | |
data JobDescriptionWithN = JobDescriptionWithNOne JobOne | JobDescriptionWithNThree JobThree | |
data JobDescription = JobDescriptionTwo JobTwo | JobWithN JobDescriptionWithN |
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
val scanner = accumulo.connector.createScanner(tableName, new Authorizations()) | |
val iteratorSetting = new IteratorSetting(Int.MaxValue, classOf[RowCounterIterator]) | |
scanner.addScanIterator(iteratorSetting) | |
val iterator = scanner.iterator() | |
iterator.hasNext shouldEqual true | |
val entry = iterator.next() | |
entry.getValue.get().length shouldEqual 0 | |
println(entry) | |
LongByteCodec.decode(entry.getKey.getRowData.toArray) shouldEqual daySubscriberProfiles.size | |
scanner.close() |
OlderNewer