Skip to content

Instantly share code, notes, and snippets.

View ikwattro's full-sized avatar

Christophe Willemsen ikwattro

View GitHub Profile
@ikwattro
ikwattro / pool.md
Created January 9, 2016 23:31 — forked from krakjoe/pool.md
Pooling

Easy pthreads Pools

The final solution !!

Since the first version of pthreads, PHP has had the ability to initialize Worker threads for users. Onto those Worker threads are stacked objects of class Stackable for execution concurrently.

The objects stacked onto workers do not have their reference counts changed, pthreads forces the user to maintain the reference counts in userland, for the extremely good reason that this enables the programmer to keep control of memory usage; and so, execute indefinitely.

This is the cause of much heartache for newcomers to pthreads; if you do not maintain references properly you will, definitely, experience segmentation faults.

@ikwattro
ikwattro / pthreads.md
Created January 9, 2016 23:30 — forked from krakjoe/pthreads.md
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@ikwattro
ikwattro / test.java
Created December 5, 2015 17:22
test
package com.graphaware.test;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.neo4j.graphdb.*;
import org.neo4j.test.TestGraphDatabaseFactory;
import static org.junit.Assert.assertEquals;
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
1;Toy Story (1995);Animation|Children's|Comedy
2;Jumanji (1995);Adventure|Children's|Fantasy
3;Grumpier Old Men (1995);Comedy|Romance
4;Waiting to Exhale (1995);Comedy|Drama
@ikwattro
ikwattro / ws-cli.php
Created October 25, 2015 21:58 — forked from ZiTAL/ws-cli.php
php: simple websocket client
<?php
/*
based on: http://stackoverflow.com/questions/7160899/websocket-client-in-php/16608429#16608429
FIRST EXEC PYTHON SCRIPT TO GET HEADERS
*/
$ws = new ws(array
(
'host' => '127.0.0.1',
'port' => 8080,
@ikwattro
ikwattro / test.md
Last active October 16, 2015 16:17
tables test
Pattern Total time Query Performed  Mean  Min Max Variance Results Min Result Max  Result Mean
MATCH (a:X)-->(b)-->(c) WHERE NOT (a)-->(c) 2566811 1395233 1.839 0 761162 474476.78 0 365352 30.739
@ikwattro
ikwattro / northwind.html
Created October 15, 2015 01:41
northwing html embedded browser
<article class="guide">
<carousel class="deck container-fluid">
<slide class="row-fluid">
<div class="col-sm-3">
<h3>Northwind Graph</h3>
<p class="lead">From RDBMS to Graph, using a classic dataset</p>
</div>
<div class="col-sm-9">
<p>The<em>Northwind Graph</em> demonstrates how to migrate from a
relational database to Neo4j. The transformation
@ikwattro
ikwattro / spark-neo4j-pagerank.scala
Created October 14, 2015 09:37 — forked from jexp/spark-neo4j-pagerank.scala
DBPedia in Neo4j -> Read from Neo4j -> Run PageRank (5 iterations) -> Write back to Neo4j
// running spark on a large single machine
// 6 workers, with 12G RAM each -> 72G total and 8G for the driver -> 80G RAM in total
// the machine has 6 physical CPUs
// the jar contains just AnormCypher.org + Dependencies
neo@neo:/tmp/spark$ bin/spark-shell --jars ../neo4j/target/scala-2.10/Neo4j-Spark-Demo-assembly-1.0.jar --driver-memory 8G --executor-memory 12G --master local[6]
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
@ikwattro
ikwattro / nodes.csv
Last active October 3, 2015 14:26
SO Question LOAD CSV
Node Name Label
1 Amada Emory Female
2 Rana Seely Female
3 Detra Thatcher Female
4 Melda Reza Female
5 Shana Willems Female
6 Sharonda Peele Female
7 Dagny Agee Female
8 Tisa Woodman Female
9 Shelba Mutcheler Female
@ikwattro
ikwattro / mockdata.csv
Created September 7, 2015 12:00
mockdata
id first_name last_name email country ip_address
1 Ernest Gordon [email protected] China 64.187.142.69
2 Judith Lopez [email protected] Indonesia 106.38.162.228
3 Kathleen Robinson [email protected] Brazil 78.43.13.107
4 Billy Alvarez [email protected] Portugal 102.99.52.239
5 Betty Garcia [email protected] Russia 246.34.181.185
6 Clarence Baker [email protected] Anguilla 75.84.172.170
7 Henry Wagner [email protected] China 171.184.44.129
8 George Adams [email protected] Palestinian Territory 23.227.124.15
9 Kathy Elliott [email protected] China 132.139.110.4