Skip to content

Instantly share code, notes, and snippets.

View ikwattro's full-sized avatar

Christophe Willemsen ikwattro

View GitHub Profile
@jexp
jexp / neo-http-shell.sh
Created June 17, 2015 20:11
Simulate Neo4j Shell via HTTP-Endpoint with Auth
#!/bin/bash
# usage neo.sh [-h host:port] [-u user:pass] [cmd]
# end cypher statements with semicolon
# terminate read loop with ^d or return
HOST="localhost:7474"
if [ "$1" == "-h" ]; then
shift; HOST="$1";shift;
fi
AUTH=""
[
{
"op": "core/text-transform",
"description": "Text transform on cells in column Tweet Id using expression grel:substring(value,1,length(value)-1)",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "Tweet Id",
"expression": "grel:substring(value,1,length(value)-1)",
@jexp
jexp / __numbers_31.txt
Last active December 14, 2016 00:59
Concurrent Neo4j Performance Tests via HTTP + Cypher (usage: ./_run_ab.sh 4 10000 create_plain.json)
Unusable on spinning disk, these results are from an SSD.
1M x create node+rel in 38s, 26k r/s
1M x create 2 nodes, 2 relationships, 2 properties in 47s, 21k r/s -> 80k records / s
1M x create 2 nodes with labels, 2 rels, 0 properties in 140s, 7k r/s
100k x create 100 rel + node -> 10M in 20s, 5k r/s
1M lookups by id in 22s, 43k r/s
1M lookup by id compiled runtime in 21s, 47k r/s
@mattes
mattes / boot2docker-nfs.rb
Last active December 4, 2023 12:07
docker-machine/ boot2docker with NFS instead of vboxsf
#!/usr/bin/env ruby
# Usage
# $ docker-machine create my-machine123 -d virtualbox
# $ ruby <(curl -L https://git.io/vvvco) my-machine123
# https://gist.github.com/mattes/4d7f435d759ca2581347
require 'erb'
bootlocalsh = %Q(#/bin/bash
Date EST Max_TemperatureC Mean_TemperatureC Min_TemperatureC Dew_PointC MeanDew_PointC Min_DewpointC Max_Humidity Mean_Humidity Min_Humidity Max_Sea_Level_PressurehPa Mean_Sea_Level_PressurehPa Min_Sea_Level_PressurehPa Max_VisibilityKm Mean_VisibilityKm Min_VisibilitykM Max_Wind_SpeedKm_h Mean_Wind_SpeedKm_h Max_Gust_SpeedKm_h Precipitationmm CloudCover Events WindDirDegrees
2010-01-01 2010-1-1 6 1 -4 5 -1 -9 96 74 52 1024 1021 1019 16 15 8 26 11 32 T 6 Rain 283
2010-01-02 2010-1-2 -2 -5 -9 -9 -12 -14 74 58 42 1028 1026 1023 16 16 13 23 13 32 T 4 Snow 344
2010-01-03 2010-1-3 -3 -7 -11 -12 -14 -17 88 62 36 1028 1026 1024 16 16 16 21 9 26 0.00 0 5
2010-01-04 2010-1-4 -3 -7 -10 -8 -11 -13 80 70 60 1025 1024 1022 16 14 5 19 4 21 T 7 Snow 279
2010-01-05 2010-1-5 -2 -6 -11 -11 -12 -13 84 67 50 1024 1023 1022 16 16 16 16 9 24 0.00 4 248
2010-01-06 2010-1-6 -1 -6 -11 -11 -11 -13 80 64 47 1026 1024 1023 16 16 16 14 6 23 0.00 2 234
@jexp
jexp / JQAssistantReader.java
Last active August 29, 2015 14:07
jQAssistant concept and constraint definitions as AsciiDoc (http://jqassistant.org | http://github.com/buschmais/jqassistant)
package jexp.adoc;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.ast.ContentPart;
import org.asciidoctor.ast.DocumentHeader;
import org.asciidoctor.ast.StructuredDocument;
import java.io.File;
import java.util.*;
@kbastani
kbastani / CalendarDay.cql
Last active July 14, 2020 20:36
This gist is a Neo4j Cypher query for merging a calendar graph for a specific year. This query has 4 levels of indexes, consisting of year, month, day, hour.
// Enter the day you would like to create
WITH { day: 18, month: 1, year: 2014 } as dayMap
// Merge hours in a day
MERGE (thisDay:Day { day: dayMap.day, month: dayMap.month, year: dayMap.year })
MERGE (firstHour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: 1 })
CREATE (thisDay)-[:FIRST]->(firstHour)
FOREACH (i IN tail(range(1, 24)) |
MERGE (thishour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i })
MERGE (lasthour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i - 1 })
@widged
widged / neo4j-install.md
Last active July 11, 2020 11:57
Neo4j on the raspberry pi. Installation steps

My pi runs a raspbian distro (2013-09-25-wheezy-raspbian.zip)

Java

What the raspberry page officially recommends is the jdk. (Source: http://www.raspberrypi.org/archives/4920).

sudo apt-get update && sudo apt-get install oracle-java7-jdk

However, this doesn't include a server on the pi. The jre needs to be installed instead.

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@krakjoe
krakjoe / pthreads.md
Last active September 24, 2024 14:50
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls