Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@FaKod
FaKod / gist:1331556
Created November 1, 2011 19:05
The Neo4j Matrix Example with Neo4j-Scala
/**
* The Matrix Example
* http://wiki.neo4j.org/content/The_Matrix
*/
case class Matrix(name: String, profession: String)
object TheMatrix extends App with Neo4jWrapper with EmbeddedGraphDatabaseServiceProvider {
ShutdownHookThread {
shutdown(ds)
@FaKod
FaKod / gist:1331645
Created November 1, 2011 19:30
Creating and deleting Nodes with Neo4j Server and sjersey-client for Scala
rest {
implicit s =>
// defining note names and profession
val nodes = ("Mr. Andersson", "Hacker") ::
("Morpheus", "Hacker") ::
("Trinity", "Hacker") ::
("Cypher", "Hacker") ::
("Agent Smith", "Program") ::
("The Architect", "Whatever") :: Nil
@FaKod
FaKod / gist:1366334
Created November 15, 2011 06:33
Create and delete Neo4j Nodes via REST
case class MatrixNodeProperties(name: String, profession: String)
object CreateAndDeleteNodes extends App with Rest with SimpleWebResourceProvider {
// base location of Neo4j server instance
override def baseUriAsString = "http://localhost:7474/db/data/"
// all subsequent REST calls should use JSON notation
override val mediaType = Some(MediaType.APPLICATION_JSON)
@FaKod
FaKod / gist:1761507
Created February 7, 2012 19:49
Typed Traversal for Neo4j
trait MatrixBase {
val name: String
val profession: String
}
case class Matrix(name: String, profession: String) extends MatrixBase
case class NonMatrix(name: String, profession: String) extends MatrixBase
/**
@FaKod
FaKod / gist:2277743
Created April 1, 2012 18:58
Neo4j Typed Traverser Examples using the REST interface
{
{
/**
* follow list of nodes with relations BOTH "KNOWS" and OUT "CODED_BY"
*/
val erg = startNodes.doTraverse[Test_MatrixBase](follow -- "KNOWS" ->- "CODED_BY") {
/**
* prune evaluator is Java Script and returns false
@FaKod
FaKod / gist:2710656
Created May 16, 2012 14:13
NullPointerException @ RestRelationship
public class RestTraversalMain {
/**
* running neo4j community 1.5.2
* Matrix Example -> Node 391 is Neo
* <p/>
* Throws Exception:
* <p/>
* Exception in thread "main" java.lang.NullPointerException
@FaKod
FaKod / gist:e6724675e4ebaf9f8fa4
Created May 9, 2014 12:13
D3.js 0 fill null values with d3 series data. See http://stackoverflow.com/a/17057231/436937
function insertValues(data, value, dimension, metric, domain) {
var defaults = {};
domain.forEach(function(item) {
var v = {};
v[dimension] = item;
v[metric] = value;
defaults[item] = v;
});
_.each(data, function(item) {
@FaKod
FaKod / k8s-node.j2
Created June 28, 2016 07:38
Ansible node template for Torus installation as a Volume Plugin
#cloud-config
write-files:
- path: /opt/bin/wupiao
permissions: '0755'
content: |
#!/bin/bash
# [w]ait [u]ntil [p]ort [i]s [a]ctually [o]pen
[ -n "$1" ] && [ -n "$2" ] && while ! curl --output /dev/null \
--silent --head --fail \
http://${1}:${2}; do sleep 1 && echo -n .; done;
module Fluent
class NewKubernetesDockerTailInput < NewTailInput
Plugin.register_input("kubernetes_docker_tail", self)
desc 'The file to read the container name'
config_param :container_name_file, :string
def initialize
super
@FaKod
FaKod / code-server-deploy.yaml
Last active April 8, 2019 07:53
Code Server
apiVersion: v1
kind: Namespace
metadata:
name: code-server
---
apiVersion: v1
kind: Service
metadata:
name: code-server