Skip to content

Instantly share code, notes, and snippets.

View alf239's full-sized avatar

Alexey Filippov alf239

  • Cambridge, UK
View GitHub Profile
@alf239
alf239 / robot.py
Created November 5, 2012 10:52
Genetic algorithm for a 7-form home task
#!/usr/bin/env python
# encoding: utf-8
"""
robot.py
Created by Alexey Filippov on 2012-11-03.
Copyright (c) 2012 Alexey Filippov. All rights reserved.
"""
import sys
@alf239
alf239 / fizzbuzz.hs
Last active December 20, 2015 10:39
Fizz/Buzz
import Data.List
fizzbuzz :: Int -> String
fizzbuzz i
| divisibleBy 15 = "FizzBuzz"
| divisibleBy 5 = "Buzz"
| divisibleBy 3 = "Fizz"
| otherwise = show i
where divisibleBy = (==) 0 . mod i
object Direction extends Enumeration {
type Direction = Value
val NORTH, EAST, SOUTH, WEST, NONE = Value
def getFromShortName(shortName: Char): Direction = shortName match {
case 'N' => NORTH
case 'E' => EAST
case 'S' => SOUTH
case 'W' => WEST
case _ => NONE
@alf239
alf239 / BSM basics.ipynb
Created April 16, 2017 21:16
First steps in IHaskell
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alf239
alf239 / ib.nb
Last active September 2, 2018 19:11
Needs["JLink`"];
ReinstallJava[
ClassPath -> "C:\\TWS_API\\source\\JavaClient\\TwsApi.jar"];
LoadJavaClass["com.ib.client.Types$MktDataType"];
LoadJavaClass["com.ib.client.TickType"];
myAccounts := {};
SetSharedVariable[myAccounts];