Skip to content

Instantly share code, notes, and snippets.

View tOverney's full-sized avatar
🦓

Tristan Overney tOverney

🦓
View GitHub Profile
@tOverney
tOverney / PingPongActor.scala
Last active September 24, 2015 19:54
you start Ping and then, he plays with Pong (which is a better player that can smash).Ping can "survive" one smash and then he "becomes" vulnerable => next smash he looses.
case object Ball
case object SmashedBall
case object PleaseServe
case object YouWin
class Ping(pong: ActorRef) extends Actor {
override def receive = {
case PleaseServe =>
println("Serving")
@tOverney
tOverney / exercise1.m
Last active September 24, 2015 12:22
PCML's first assignment
% Exercice 1.1
ident33 = eye(3,3)
diag_inc = diag([1 2 3])
zeros33 = zeros(3,3)
M = rand(4,3)
T = reshape(M,6,2) % it takes them column by column
@tOverney
tOverney / Project1.scala
Last active May 31, 2016 00:12
a small project for a first hand with Spark
package main.scala
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
import org.apache.spark.rdd._
object Project1 {
def charsetFix(s : String) : String = s.filter(Character.isDefined)
object Solution {
val cong = 1000000007L
def main(args: Array[String]) {
val line = scala.io.StdIn.readLine
val tokens = tokenize(line.toIterator.buffered)
//println(s"Tokens:\n$tokens\n")
val ast = parse(tokens)
//println(s"AST:\n$ast\n")
@tOverney
tOverney / A - Sheeps.scala
Last active May 31, 2016 00:09
Google Code Jam 2016 (Online Qualification)
package main.scala
import scala.io.Source
object Sheeps extends App {
val fullSet = Set('0','1','2','3','4','5','6','7','8','9')
val path = "/Users/TristanO/Documents/projects/scalaFun/CodeJam/input.txt"
val lineIter = Source.fromFile(path).getLines()
val T = lineIter.next.toInt
for (i <- 1 to T) {
package main.scala
object ResultsToHtmlItem extends App {
private def offset: Int => String = " " * _
sealed trait HtmlElem {
def print(indent: Int): String = ""
}
case class DtDd(dtContent: HtmlElem, ddContent: HtmlElem) extends HtmlElem {
override def print(indent: Int): String = {
package relation
package compiler
import scala.collection.mutable
import ch.epfl.data.sc.pardis
import pardis.optimization.RecursiveRuleBasedTransformer
import pardis.quasi.TypeParameters._
import pardis.types._
import PardisTypeImplicits._
import java.util._
import scala.collection.mutable.MutableList
import scala.collection.mutable.Set
import scala.collection.mutable.Map
// IMPORTANT -- THIS IS INDIVIDUAL WORK. ABSOLUTELY NO COLLABORATION!!!
// - implement a (main-memory) data store with OMVCC.
// - objects are <int, int> key-value pairs.
import akka.actor._
// These are the messages sent by the Scrutineer
case object VoteIsOver
case class IssueVoted(val question: String)
// These are all the messages sent by an Assembly member
case object ImHere
sealed trait VoteOption
case object Yes extends VoteOption
@tOverney
tOverney / upload_to_flickr.py
Created November 13, 2016 21:28
Simple script to upload the content of a folder `images`
#! /usr/bin/python3
# -*- coding: utf-8 -*-
import wget, os, flickrapi, webbrowser
from pathlib import PurePosixPath, PosixPath, Path
def path(elems):
return "/".join(elems)
OUT_DIR = "images"