Skip to content

Instantly share code, notes, and snippets.

View andypetrella's full-sized avatar

Andy Petrella andypetrella

View GitHub Profile
@andypetrella
andypetrella / whishlist.txt
Last active December 15, 2015 09:19
My tech projects wish (I have time) list
* create a Neo4j Rest API on WebShell
* create a macro that will check cypher queries
* import TopoJSON in Neo4J, probably using org.neo4j.gis.spatial.pipes.GeoPipeFlow like org.neo4j.gis.spatial.pipes.processing.GeoJSON does
@andypetrella
andypetrella / mat.scala
Last active December 17, 2015 22:49
Matrix Algebra and type level programming ~> compile time checks?
/*
First implementation of a Matrix String Interpolator.
This is a manipulable matrix strucutre
mat"""
| 1 | 2
| 3 |
"""
*/
object Mat {
@andypetrella
andypetrella / Co.scala
Last active December 19, 2015 17:59
Co-Contra variance in Scala
package cocontra
import model._
object Co extends App {
val kids = List(new Kid(9))
val humans:List[Human] = kids
println(humans)
@andypetrella
andypetrella / conway.scala
Created August 7, 2013 06:10
Game of Life (Conway) in scala
object conway {
def neighbours(p:(Int, Int)) =
for {
dx <- List(-1, 0, 1)
dy <- if (dx == 0) List(-1, 1) else List(-1, 0, 1)
} yield (dx+p._1, dy+p._2)
def step(cells:List[(Int, Int)]) =
cells
@andypetrella
andypetrella / SparkAkka.scala
Last active December 20, 2015 22:39
Spark-bd blog entries
package spark
import spark.util.AkkaUtils
object SparkAkka {
private[this] lazy val config = be.bigdata.p2.conf.root.getConfig("deploy.akka")
lazy val name = config.getString("name")
lazy val host = config.getString("host")
lazy val port = config.getInt("port")
lazy val actorSystem = AkkaUtils.createActorSystem(name, host, port)._1
@andypetrella
andypetrella / mr.scala
Created August 29, 2013 15:38
MR scala
//def
val l:List[A]
val m[K,V]:A=>List[(K, V)]
val r[V]:List[V]=>V
val s[K]:K=>K
//mr
l.flatMap(m)
.groupBy(_._1)
.mapValues(_.map(_._2))
@andypetrella
andypetrella / MRTweet.scala
Last active December 22, 2015 06:19
Expressiveness, conciseness and behavior
val l:List[A]
val m[K,V]:A=>List[(K, V)]
val r[V]:List[V]=>V
val s[K]:K=>K
l .flatMap(m)
.groupBy(_._1) // map phase
.mapValues(_.map(_._2))
.groupBy{case (x, xs) => s(x) } // shuffled
.mapValues(_.map{case (x,xs) => (x, r(xs))}) // reduced
@andypetrella
andypetrella / README.md
Last active December 22, 2015 10:58
Scrapping the Belgium PICC

How to scrap the Belgium PICC

Download ESRI PICC data

Use the Query operation on the service, aksing for:

  • f=json json format
  • fields=*
  • geometryType=esriGeometryEnvelope
  • geometry=...
@andypetrella
andypetrella / build.sbt
Last active January 3, 2016 12:09
An sbt configuration for https://github.com/NightHacking/LambdasHacking. Put this in "Code" and launch sbt. IT REQUIRES SBT > 0.13.1
libraryDependencies += "junit" % "junit" % "4.11" % "test"
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"
javaSource in Test := baseDirectory.value / "test"
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
javacOptions ++= Seq("-source", "1.8")
@andypetrella
andypetrella / LCLU dans un système distribué.md
Last active August 29, 2015 14:01
Sujets de mémoire; ULg, montéfiore.

Utilisation des systèmes distribués pour l'analyse géospatiale et sociale du changement de territoire.

Le but du travail sera d'implémenter des techniques d'apprentissage et de prédiction de l'évolution d'un territoire en se basant sur un historique d'images satellitaires et envisager l'intégration des informations présentent dans un réseau social.

L'analyse géospatiale de la couverture et de l'utilisation du territoire est un des principaux sujets de recherche en géomatique et télédétection. Cela fait intervenir plusieurs techniques provenant de domaines divers, entre autres on peut citer les système de règles avec contraintes, les automates cellulaires, les réseaux probabilistes (ainsi que leurs combinaisons).

Le perfectionnement de ces techniques est indéniable mais il souffrira à terme de problèmes de performance et de "scalabilité". Cette apréhension se base sur le constat du pourcentage grandissant