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() |
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
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
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
#!/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
{-# 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
{- | |
Parsing the output of the xrandr command. For example: | |
$> xrandr | |
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767 | |
eDP1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 173mm | |
1920x1080 60.0*+ 59.9 | |
1680x1050 60.0 59.9 | |
1600x1024 60.2 | |
1400x1050 60.0 |
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 org.scalatest.FunSuite | |
import org.apache.spark.SparkConf | |
import org.apache.spark.SparkContext | |
class MyTestSuite extends FunSuite { | |
val conf = new SparkConf() | |
.setAppName("My Spark test") |
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
function! IndentAsPrevLine() | |
python << EOF | |
import itertools as I | |
from vim import * | |
if current.range.start > 0: | |
def takewhile(pred,l): return ''.join(I.takewhile(pred,l)) | |
prev_line = current.buffer[current.range.start - 1] |
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.higherKinds | |
import scala.math.{pow} | |
import scalaz._ | |
import Scalaz._ | |
import scalaz.effect._ | |
case class Point(_x : Double, _y : Double) | |
case class GameUnit(_health : Int, _position : Point) |
NewerOlder