Skip to content

Instantly share code, notes, and snippets.

@tyrcho
tyrcho / Dockerfile
Created February 6, 2015 08:48
activiti explorer in tomcat 7 - docker
FROM tomcat:7
RUN curl -SL https://github.com/Activiti/Activiti/releases/download/activiti-5.17.0/activiti-5.17.0.zip -o activiti.zip \
&& unzip activiti.zip \
&& rm activiti.zip \
&& cp activiti-5.17.0/wars/activiti-explorer.war webapps \
&& rm -rf activiti-5.17.0
@tyrcho
tyrcho / MergeMaps.scala
Created January 29, 2015 08:30
Recursive (deep) merge of 2 maps
object Maps {
implicit class MergableMap[K](map: Map[K, _]) {
/**
* Override values from this with values from that.
*/
def deepMerge(that: Map[K, _]): Map[K, _] =
(for (k <- map.keys ++ that.keys) yield {
val newValue =
(map.get(k), that.get(k)) match {
@tyrcho
tyrcho / README.md
Last active February 7, 2018 01:35
Sample pom.xml for scala 2.11 in Eclipse
@tyrcho
tyrcho / README.md
Created November 7, 2014 13:24
default application (windows)

Allows to change the default program Windows uses for filew with unknown file extension.

@tyrcho
tyrcho / sample
Last active August 29, 2015 14:08
Sample HS log extract
MatchStart(HeroChosen(Gul'dan,Warlock,false,1))
HeroPowerDeclared(CS2_056,1)
CardEvent(,6,ADDED_TO_DECK,1)
CardEvent(,7,ADDED_TO_DECK,1)
CardEvent(,8,ADDED_TO_DECK,1)
CardEvent(,9,ADDED_TO_DECK,1)
CardEvent(,10,ADDED_TO_DECK,1)
CardEvent(,11,ADDED_TO_DECK,1)
CardEvent(,12,ADDED_TO_DECK,1)
CardEvent(,13,ADDED_TO_DECK,1)
@tyrcho
tyrcho / README.md
Last active August 29, 2015 14:06 — forked from tyrcho/README.md
Implementation of Hearthstone mulligans with scala-js-fiddle.

Open with scala-js-fiddle for a demo

Implementation of Hearthstone mulligans with scala-js-fiddle.

Examples

  • There are 2 important cards in a deck, but you don't keep them in the mulligan phase (let's say 2 Doomguards in zoo). What is the probability to have at least one in hand at a given turn, if the player did not start the game ?
  • You think an opponent plays one Sylvanas. You started the game. What is the probability he has drawn it, assuming he does not keep it in the mulligans ?
  • You play 4 acceleration (Innervate, Wild Growth) cards. By mulliganing everything except those, what is the probability to have exactly one in starting hand ?
@tyrcho
tyrcho / FrequencyTable.scala
Last active August 29, 2015 14:04
Computing frequency table in scala using breeze
import breeze.linalg._
import scala.collection.mutable.Map
object FrequencyTable extends App {
val lines = io.Source.fromFile("t:/frequency.csv").getLines.take(10000000).toList ++
(List("washington", "taxes", "treasury") map { w => s"test,$w,1" })
val docs = Map.empty[String, Int]
val words = Map.empty[String, Int]
var docCount = -1
var wordCount = -1
@tyrcho
tyrcho / README.md
Last active September 4, 2017 16:41
Langton's ant
@tyrcho
tyrcho / Gitter Travis integration.md
Created July 9, 2014 12:24
Gitter Travis integration.md

Gitter / Travis integration

In the [.travis.yml][1] file :

 webhooks:
    urls:
      - https://webhooks.gitter.im/e/3069b7e759e1d02548c1
    on_success: always  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always

on_start: false # default: false

@tyrcho
tyrcho / Gitter Travis integration
Created July 9, 2014 12:23
Gitter Travis integration.md
# Gitter / Travis integration
In the [.travis.yml][1] file :
webhooks:
urls:
- https://webhooks.gitter.im/e/3069b7e759e1d02548c1
on_success: always # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false