Skip to content

Instantly share code, notes, and snippets.

@jeffreylovitz
jeffreylovitz / Cypher.g4
Created October 28, 2020 19:37
Cypher ANTLR grammar
/**
* Copyright (c) 2015-2020 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
#/bin/bash
python3 bulk_insert.py G \
-n data/n0.csv \
-n data/n1.csv \
-n data/n2.csv \
-n data/n3.csv \
-n data/n4.csv \
-r data/e10.csv \
-r data/e11.csv \
@jeffreylovitz
jeffreylovitz / benchmarks.md
Last active April 27, 2020 20:55
Hiredis nested bulk benchmarking

System info

$ uname -a
Linux towerlinux 4.15.0-96-generic #97-Ubuntu SMP Wed Apr 1 03:25:46 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
@jeffreylovitz
jeffreylovitz / Makefile
Last active December 17, 2019 16:14
Valgrind report on multithreaded GraphBLAS
CFLAGS = -D_GNU_SOURCE -std=gnu99 -fopenmp -g
GRAPHBLAS=../deps/GraphBLAS/build/libgraphblas.a
all:
$(CC) $(CFLAGS) -o possible_leak possible_leak.c $(GRAPHBLAS) -lpthread -lm
clean:
rm possible_leak

Valgrind + GDB control

When a memory error is encountered, execution will pause and live debugging can be performed using GDB.

valgrind --vgdb-error=0 redis-server /path/to/redis.conf

Valgrind + function call + runtime profiler (Callgrind)

Generate call graphs that can be visualized to detect program bottlenecks. (I use KCacheGrind for visualization.)

@jeffreylovitz
jeffreylovitz / node_realloc_test.c
Created July 2, 2018 11:54
node blocks realloc test
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int prints;
#define NODEBLOCK_CAP 256
#define MAX(a, b) \
@jeffreylovitz
jeffreylovitz / node_search.c
Last active March 17, 2018 17:41
Modified Node search
// Overall search function; takes in a skiplist node
int invoke(skiplistNode *sl_node, Node *val) {
int idx = modified_bsearch((Node **)sl_node->vals, 0, sl_node->sortedThreshold, val);
if (idx >= 0) return idx;
for (int i = sl_node->sortedThreshold; i < sl_node->numVals; i ++) {
if (sl_node->vals[i]->id == val->id) {
return i;
}
}
@jeffreylovitz
jeffreylovitz / reformat.md
Last active April 11, 2017 15:04
Reformatting a laptop

Reformatting a laptop

  1. Choose an operating system
  • Windows
    • Hopefully, you have a Windows disk lying around somewhere. These used to ship with all new Windows computers, but I didn't get one with my latest laptop, so I don't know.
  • Linux
    • Linux is free, so just use the following download link:
  1. Choose an install method
  • The two options are to use a disk or to use a thumb drive; you'll want to just do whichever is more convenient. Thumb drives sometimes require a bit of extra effort, but don't require DVD burners.

My toolkit!


A collection of notes that I hope will not sound at all condescending. When I was in college, I felt really abstracted from what I imagined coding as a career to be. It turned out that I was wrong, and all of that stuff was actually really important, but luckily I osmoted enough knowledge or something to drop out like a champ. Anyway, my belief is that environment inherently acts to inform consciousness and experience! Wow, that was out of nowhere! No, it was out of the tenets of phenomenology, and I swear it makes sense here. As a coding person, you are the master of your domain, and every tool you use to make your environment an extension of yourself facilitates workthrough, reduces context switches, etc. And I feel like maybe if I'd been more in touch with that when I was in school, I wouldn't have imagined such a schism separating me from real programmers.

I am the love that dare not speak its name


Whoa, that was a bold reference! Did the situation warrant it? No, but we watched