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
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]; |
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 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
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 |
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 Data.List | |
fizzbuzz :: Int -> String | |
fizzbuzz i | |
| divisibleBy 15 = "FizzBuzz" | |
| divisibleBy 5 = "Buzz" | |
| divisibleBy 3 = "Fizz" | |
| otherwise = show i | |
where divisibleBy = (==) 0 . mod i |
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 | |
# encoding: utf-8 | |
""" | |
robot.py | |
Created by Alexey Filippov on 2012-11-03. | |
Copyright (c) 2012 Alexey Filippov. All rights reserved. | |
""" | |
import sys |
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
public class Deadlock implements Runnable { | |
private final Object a; | |
private final Object b; | |
private final static CountDownLatch latch = new CountDownLatch(2); | |
public Deadlock(Object a, Object b) { | |
this.a = a; | |
this.b = b; | |
} |
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
package org.acm.afilippov; | |
import java.beans.IntrospectionException; | |
import java.beans.Introspector; | |
import java.beans.PropertyDescriptor; | |
public class Chain { | |
private int i; | |
public int getI() { |
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
public class VolatileExample implements Runnable { | |
public static boolean flag = true; // do not try this at home | |
public void run() { | |
long i = 0; | |
while (flag) { | |
if (i++ % 10000000000L == 0) | |
System.out.println("Waiting " + System.currentTimeMillis()); | |
} | |
} |
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
def env = System.getenv() | |
def gitcmd = "git" | |
if (env["com.apple.java.jvmMode"]) | |
gitcmd = "/usr/local/git/bin/git" | |
if (env["OS"] =~ /^Windows/) | |
gitcmd = "cmd /c ${gitcmd}" | |
def gitDescribe = """${gitcmd} describe""".execute().in.text.trim() | |
def m = gitDescribe =~ /(?:atlas-)?(.*)/ | |
def gitBranch = """${gitcmd} symbolic-ref -q HEAD""".execute().in.text.trim() |
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
$.each( | |
$.grep( | |
$(".l_expandcomments"), | |
function(e) { | |
var m = /(\d+) more comments/.exec(e.innerHTML); | |
return m && parseInt(m[1]) > 10; | |
}), | |
function() { | |
$(".l_hideone", $(this).parents(".l_entry")) | |
.click(); |
NewerOlder