Skip to content

Instantly share code, notes, and snippets.

View aneeshdurg's full-sized avatar
💻
SGVsbG8gd29ybGQh

Aneesh Durg aneeshdurg

💻
SGVsbG8gd29ybGQh
View GitHub Profile
@aneeshdurg
aneeshdurg / importLDBCToJanusGraph.groovy
Last active April 9, 2024 15:24
Load LDBC CSV files into JanusGraph
// Usage: bin/gremlin.sh -e load.groovy
// This file loads LDBC CSV files into a graph
import java.text.SimpleDateFormat
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
timestampFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
def defineSchemaAndIndices(graph) {
mgmt = graph.openManagement(); // create management object
// define vertex labels
@aneeshdurg
aneeshdurg / dump_ast.py
Created March 19, 2023 16:09
Python script to dump a C++ file's AST (using libclang)
#!/usr/bin/env python3
from pathlib import Path
from typing import Optional
import click
import clang.cindex
def dump_ast(tu: clang.cindex.TranslationUnit):
@aneeshdurg
aneeshdurg / grammer.cypher
Last active March 27, 2022 03:55
A OpenCypher query to create a graph modelling the heirarchy of OpenCypher expressions
CREATE
(OC_AddOrSubtractExpression :AddOrSubtractExpression),
(OC_AndExpression :AndExpression),
(OC_AnonymousPatternPart :AnonymousPatternPart),
(OC_Atom :Atom),
(OC_BooleanLiteral :BooleanLiteral),
(OC_CaseAlternatives :CaseAlternatives),
(OC_CaseExpression :CaseExpression),
(OC_ComparisonExpression :ComparisonExpression),
(OC_Create :Create),
@aneeshdurg
aneeshdurg / index.html
Created July 15, 2020 17:27
Using MediaSource with a ReadableStream (fetchAPI)
<script>
/**
An example of using MediaSource with a stream.
Based off of http://nickdesaulniers.github.io/netfix/demo/bufferAll.html
*/
document.addEventListener("DOMContentLoaded", async () => {
var video = document.querySelector('video');
var assetURL = 'frag_bunny.mp4';
@aneeshdurg
aneeshdurg / thinkpad_backlight_notifications.py
Last active April 9, 2024 15:23
This script will flash the keyboard backlight when a notifcation is recieved.
#!/usr/bin/python2 -u
# Needs to run with unbuffered python
"""
This script will flash the keyboard backlight when a notifcation is recieved.
The number of flashes/duration can be configured in 'config.json'.
Note that the parameter 'user' must be the user whose notifications should be
monitored.
Usage: