Skip to content

Instantly share code, notes, and snippets.

View variance-reduce2.js
this.getReducedSTD2 = function(dimensionGroup, variable) {
// see https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
var reduceAdd = function (p, v) {
var value = +v.variables[variable];
if( _.isNaN(value) ) {
//pass
}
else {
if( p.n === 0 ) {
p.k = value;
View variance-reduce.js
this.getReducedSTD = function(dimensionGroup, variable) {
// see https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Decremental_algorithm
var reduceAdd = function (p, v) {
var obj = p;
var value = +v.variables[variable];
if( _.isNaN(value) ) {
//pass
} else {
obj.n = obj.n + 1;
var oldM2 = obj.M2;
@amergin
amergin / dc.problem.seriesChart.js
Created Dec 30, 2014
Problem with DC.js series chart grouping and sorting
View dc.problem.seriesChart.js
var createSVG = function($scope, config) {
var getLabel = function(variable, circle) {
return variable + " (" + circle.name() + ")";
};
var getLabels = function() {
var ret = [];
_.each(config.groups, function(group, name) {
_.each( $scope.filterOnSet(group, name).all(), function(obj) {
var circle = obj.key.circle;
@amergin
amergin / angular-packery.js
Created Aug 6, 2014
Angular-masonry fork for Packery.js
View angular-packery.js
/*!
* angular-packery
* Forked from angular-masonry (Pascal Hartig, weluse GmbH, http://weluse.de/)
*/
(function () {
'use strict';
angular.module('wu.packery', []).controller('PackeryCtrl', [
'$scope',
'$element',
'$timeout',
@amergin
amergin / vmstat_loading.txt
Created Jan 1, 2013
vmstat while warming the graph.
View vmstat_loading.txt
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 175424 7509264 656956 17513120 0 0 38 20 0 0 1 1 98 0 0
1 0 175424 7487780 656968 17517780 0 0 1651 0 5169 22462 5 4 88 4 0
1 0 175424 7450576 656976 17518080 0 0 5 156 7185 24458 21 3 76 0 0
1 0 175424 7453236 656976 17518080 0 0 0 168 5435 22729 12 4 83 0 0
1 0 175424 7428040 656984 17518080 0 0 0 4 5201 20206 13 3 84 0 0
9 0 175424 7370016 656984 17518080 0 0 0 12 7874 21739 25 4 71 0 0
3 0 175424 7312612 656988 17518084 0 0 1 11 7502 22395 22 4 73 0 1
2 0 175424 7277488 656988 17518084 0 0 0 47 7545 23143 26 5 69 0 1
@amergin
amergin / vmstat_idle_3min.txt
Created Jan 1, 2013
timeout 3m vmstat 3 > ~/vmstat_loading_3min.txt
View vmstat_idle_3min.txt
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 175424 6648152 656812 17511332 0 0 38 20 0 0 1 1 98 0 0
1 0 175424 6648136 656812 17511336 0 0 0 4 3436 21147 1 2 97 0 0
0 0 175424 6648136 656816 17511336 0 0 0 11 3361 21589 1 2 97 0 0
0 0 175424 6648136 656816 17511336 0 0 0 5 3418 21793 1 2 97 0 0
0 0 175424 6648136 656816 17511336 0 0 0 4 3687 21588 1 2 97 0 0
0 0 175424 6648136 656816 17511344 0 0 3 16 3599 21750 1 2 97 0 0
0 0 175424 6647988 656820 17511348 0 0 0 21 3850 22033 1 2 97 0 0
0 0 175424 6647988 656820 17511348 0 0 0 3 3926 21425 1 2 96 0 0
@amergin
amergin / messages.log
Created Dec 31, 2012
messages.log, relevant parts
View messages.log
2012-12-31 00:23:14.528+0000 INFO [o.n.k.i.DiagnosticsManager]: --- INITIALIZED diagnostics START ---
2012-12-31 00:23:14.529+0000 INFO [o.n.k.i.DiagnosticsManager]: Neo4j Kernel properties:
2012-12-31 00:23:14.532+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.propertystore.db.mapped_memory=3000M
2012-12-31 00:23:14.533+0000 INFO [o.n.k.i.DiagnosticsManager]: cache_type=gcr
2012-12-31 00:23:14.533+0000 INFO [o.n.k.i.DiagnosticsManager]: read_only=true
2012-12-31 00:23:14.533+0000 INFO [o.n.k.i.DiagnosticsManager]: use_memory_mapped_buffers=true
2012-12-31 00:23:14.533+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.nodestore.db.mapped_memory=50M
2012-12-31 00:23:14.533+0000 INFO [o.n.k.i.DiagnosticsManager]: ha.pull_interval=10
2012-12-31 00:23:14.533+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.relationshipstore.db.mapped_memory=1200M
2012-12-31 00:23:14.533+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.propertystore.db.strings.mapped_memory=1000M
@amergin
amergin / dump_while_traversing_highCPU.txt
Created Dec 31, 2012
jstack dump while high-CPU traversal.
View dump_while_traversing_highCPU.txt
2012-12-31 02:28:04
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.10-b01 mixed mode):
"1964274118@qtp-2058324786-4" prio=10 tid=0x00007ff2a8014800 nid=0x6429 in Object.wait() [0x00007ff271190000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000005337d6da0> (a org.mortbay.thread.QueuedThreadPool$PoolThread)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:626)
- locked <0x00000005337d6da0> (a org.mortbay.thread.QueuedThreadPool$PoolThread)
@amergin
amergin / dump_after_warming_idle.txt
Created Dec 31, 2012
jstack after warming the cache, at idle, CPU ~33%.
View dump_after_warming_idle.txt
2012-12-31 02:25:57
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.10-b01 mixed mode):
"Attach Listener" daemon prio=10 tid=0x00007ff318003800 nid=0x63fe waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"712944945@qtp-2058324786-3" prio=10 tid=0x00007ff2a8003800 nid=0x63d0 in Object.wait() [0x00007ff25502e000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000005202a9ef0> (a org.mortbay.thread.QueuedThreadPool$PoolThread)
@amergin
amergin / gist:4262270
Created Dec 11, 2012
Cypher branching example
View gist:4262270
START a = node(137059)
MATCH a-[rel]->b
WITH a,b,rel
ORDER BY rel.pvalue DESC LIMIT 5
MATCH b-[rel2]->c
WITH a,b,c,rel,rel2
ORDER BY rel2.pvalue DESC LIMIT 5
RETURN a.label?, rel.pvalue, b.label?, b.source, rel2.pvalue, c.label?, c.source;