Skip to content

Instantly share code, notes, and snippets.

View jexp's full-sized avatar
🐉
Watching the chamaeleon.

Michael Hunger jexp

🐉
Watching the chamaeleon.
View GitHub Profile
@jexp
jexp / neo4j-wait.sh
Created January 19, 2017 15:01 — forked from benbc/neo4j-wait.sh
Example of using curl to wait for a Neo4j server to be up
#!/bin/bash
end="$((SECONDS+10))"
while true; do
[[ "200" = "$(curl --silent --write-out %{http_code} --output /dev/null http://localhost:7474)" ]] && break
[[ "${SECONDS}" -ge "${end}" ]] && exit 1
sleep 1
done

The TrumpWorld Graph

@jexp
jexp / _links.adoc
Last active December 8, 2016 16:08
Run Multi-Instance Causal Cluster of Neo4j 3.1 RC1 (also see the links)
@jexp
jexp / ms-concepts-import.sh
Created November 4, 2016 02:32
Load and query the Microsoft Concept Graph in Neo4j https://concept.research.microsoft.com/Home/Introduction
function import_extract_first {
echo "name:ID(Concept)" > concepts.txt
cat data-concept-instance-relations.txt | cut -d $'\t' -f 1 | sort | uniq >> concepts.txt
echo "name:ID(Instance)" > instances.txt
cat data-concept-instance-relations.txt | cut -d $'\t' -f 2 | sort | uniq >> instances.txt
echo $':END_ID(Concept)\t:START_ID(Instance) relations:int' > is_a.hdr
$NEO4J_HOME/bin/neo4j-import --into concepts.db --id-type string --delimiter TAB --bad-tolerance 13000000 --skip-duplicate-nodes true --skip-bad-relationships true \
@jexp
jexp / CallerBlocksPolicy.java
Last active August 4, 2020 10:10
CallerBlocksPolicy as alternative to CallerRunsPolicy if the calling thread and the pool threads(tasks) share a similar thread local which would then be messed up.
public static ExecutorService createDefaultPool() {
int threads = Runtime.getRuntime().availableProcessors()*2;
int queueSize = threads * 25;
return new ThreadPoolExecutor(threads / 2, threads, 30L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(queueSize),
new CallerBlocksPolicy());
// new ThreadPoolExecutor.CallerRunsPolicy());
}
static class CallerBlocksPolicy implements RejectedExecutionHandler {
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active April 20, 2024 13:55
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

@graphadvantage
graphadvantage / neo4j-azure-bitlocker.md
Last active October 29, 2020 14:26
Neo4j 3.1 Performance on Azure VM with Bitlocker Disk Encryption - 2 Billion Relationships, 450 Million Nodes

Neo4j 3.1 Performance on Azure VM with Bitlocker Disk Encryption

2 Billion Relationships, 450M Nodes on an Azure VM

Introduction

I recently completed an interesting POC of Neo4j 3.1 on Azure, and discovered that there's not much in the way of documentation out there. This Gist provides some notes on how to deploy Neo4j on Azure in enterprise settings, and examines the impact of Bitlocker disk encryption on Neo4j performance for common tasks.

TopLine

@jexp
jexp / how-is-x-done.adoc
Created June 28, 2016 10:01
neo4j knowledge base template

How is X done

To display the nodes with the most properties defined, run the following Cypher Statement:

@jexp
jexp / RunNeo4jImport.bat
Last active May 24, 2017 08:41
launch neo4j-shell in Neo4j-Desktop (exe on Windows, dmg on OSX)
"C:\Program Files\Neo4j Community\jre\bin\java" -cp "C:\Program Files\Neo4j Community\bin\neo4j-desktop-3.0.2.jar" \
org.neo4j.tooling.ImportTool %*
// On https://analytics.twitter.com/user/<name>/home
// run this in developer console
// essentially:
$(".home-group-row").map(function(x) { var group=$(this); return group.find(".home-group-header").text()+","+ ['tweets','tweetviews','profile-views','mentions','followers'].map(function(tag) { return group.find(".metric-"+tag).text(); }).join(","); }).toArray().join("\n")
// prettied up:
var metrics = ['tweets','profile-views','mentions','followers','tweetviews'];
"month\t" + metrics.join("\t") + "\n" +