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 java.util.Arrays; | |
import java.util.stream.IntStream; | |
public class Main { | |
final static int GMOD = 0x8000; | |
final static int MOD = 0x8003; | |
final static int DEG = 15; | |
final static int[] f1 = new int[GMOD]; | |
static int[][] wf1; |
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
USING PERIODIC COMMIT 5000 | |
LOAD CSV FROM 'file:///home/roman/dirs1.csv' AS line | |
MATCH | |
(parent:Node {nid: toInt(line[0])}), | |
(child: Node {nid: toInt(line[1])}) | |
CREATE | |
(child)-[:CHILD_OF]->(parent) |
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 dumpCypher() { | |
val createConstraint = """create index on :Node(nid)""" | |
val dumpNodes = | |
"""USING PERIODIC COMMIT 5000 | |
|LOAD CSV WITH HEADERS FROM 'file:///home/roman/toDump.csv' AS line | |
|CREATE (c:Node {title: line.title, nid: toInt(line.nid)})""".stripMargin | |
val db = new GraphDatabaseFactory().newEmbeddedDatabase("/tmp/skip") | |
val cypher = new ExecutionEngine(db) |
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
private void bootstrapWebGUI(final String host, final Integer port) { | |
final Configurator cfg = new ServerConfigurator((GraphDatabaseAPI) db); | |
cfg.configuration().setProperty(Configurator.WEBSERVER_PORT_PROPERTY_KEY, port); | |
cfg.configuration().setProperty(Configurator.WEBSERVER_ADDRESS_PROPERTY_KEY, host); | |
webServer = new WrappingNeoServer((GraphDatabaseAPI) db, cfg); | |
webServer.start(); | |
} |
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 UnsignedLong incrementProperty(final UnsignedLong id, final String propKey, final UnsignedLong incrementAmount) { | |
return changePropValue(id, propKey, oldProp -> oldProp.plus(incrementAmount)); | |
} | |
public UnsignedLong decrementProperty(final UnsignedLong id, final String propKey, final UnsignedLong decrementAmount) { | |
return changePropValue(id, propKey, oldProp -> oldProp.minus(decrementAmount)); | |
} | |
public UnsignedLong getProperty(final UnsignedLong id, final String propKey) { | |
return changePropValue(id, propKey, Function.identity()); |
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 java.util | |
import java.util.Collections | |
import scala.util.Random | |
object Perceptron { | |
def main (args: Array[String]) { | |
val Variant = 13 | |
val CsvRegex = """(.+)\;(.+)\;(.+)""".r |
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 java.util.*; | |
import java.util.function.*; | |
import java.util.stream.*; | |
import org.neo4j.graphdb.GraphDatabaseService; | |
import org.neo4j.graphdb.Transaction; | |
/** | |
* Delegates all operations to an underlying Stream, but wraps them in transactions. | |
* Transaction is wrapped around the whole method call (i.e. map(), forEach() etc.), | |
* so may become potentially heavy. |
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 T fn(int required) { | |
return fn(required, "defaultString"); | |
} | |
public T fn(int required, String optional) { | |
fn(required, optional, false); | |
} | |
public T fn(int required, String optional, boolean flag) { | |
// BUSINESS SHIT |
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 fn(x: Int, optStr: String = "defaultValue", flag: Boolean = false) = { | |
// BUSINESS SHIT | |
} |
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 fn(x: Int, optStr: Option[String], flag: Option[Boolean]) = { | |
businessShit(x, optStr.getOrElse("defaultValue"), flag.getOrElse(false)) | |
} |
OlderNewer