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
docker run --name mysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql/mysql-server:latest | |
docker run --name myadmin -d -p 8888:80 --link mysql:db phpmyadmin/phpmyadmin | |
docker run --name rabbitmq -d -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671 -p 15672:15672 -p 25672:25672 rabbitmq:3-management |
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
docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d mysql:latest | |
docker run --name myadmin -d --link mysql:db -p 8888:80 phpmyadmin/phpmyadmin |
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
resourceGenerators in Compile <+= (WebKeys.public in Assets, version).map { | |
case (dir, v) => | |
val file = dir / "version.txt" | |
val gitCommit = Process("git rev-parse HEAD").lines.head | |
val content = "version=%s git-commit=%s".format(v, gitCommit) | |
IO.write(file, content) | |
Seq(file) | |
} |
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
<!-- | |
If you wish to turn off checking for a section of code, you can put a comment in the source | |
before and after the section, with the following syntax: | |
// scalastyle:off | |
... // stuff that breaks the styles | |
// scalastyle:on | |
You can also disable only one rule, by specifying its rule id, as specified in: |
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
<!-- | |
If you wish to turn off checking for a section of code, you can put a comment in the source | |
before and after the section, with the following syntax: | |
// scalastyle:off | |
... // stuff that breaks the styles | |
// scalastyle:on | |
You can also disable only one rule, by specifying its rule id, as specified in: |
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
type Tokenizer = String => Seq[Token] | |
val tokenizer = new Tokenizer { | |
override def apply(input: String): Seq[Token] = input.foldRight(Seq("")) { | |
case (c, acc) if Character.isMirrored(c) => Seq("", c.toString) ++ acc | |
case (c, acc) => Seq(c + acc.head) ++ acc.tail | |
}.map(_.trim).filter(_.nonEmpty).map { | |
str => Token(str, str match { | |
case "(" | "{" | "[" | "<" => TokenType.LPAREN | |
case ")" | "}" | "]" | ">" => TokenType.RPAREN | |
case _ => TokenType.STR |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
expression = simple_expression* | |
simple_expression = str | ( expression ) | |
""" | |
class Expression: | |
def __init__(self): |
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 numpy as np | |
import pylab as pl | |
from numpy import fft | |
def fourierExtrapolation(x, n_predict): | |
n = x.size | |
n_harm = 10 # number of harmonics in model | |
t = np.arange(0, n) | |
p = np.polyfit(t, x, 1) # find linear trend in x | |
x_notrend = x - p[0] * t # detrended x |
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
/* | |
* Holt-Winters Forecasting Method. | |
* Written by Artem Tartakynov. | |
* This particular implementation uses immutable collections and possibly | |
* creates a lot of work for garbage collector. Please feel free to use or modify it in | |
* whatever way best works for you. | |
* | |
* References: | |
* Jia Li and Andrew W. Moore. Forecasting Web Page Views: Methods and Observations. 2008. | |
*/ |
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
from math import ceil | |
from tabulate import tabulate | |
GiB = 1024 | |
TiB = 1048576 | |
def main(): | |
""" | |
Calculates cluster growth plan based on numbers listed below | |
""" |