Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View voutilad's full-sized avatar
🥸

Dave Voutila voutilad

🥸
View GitHub Profile
@voutilad
voutilad / fun.c
Created December 22, 2022 19:12
Example of sharing a page between processes after fork+exec.
/*
* Copyright (c) 2022 Dave Voutila <dave@sisu.io>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@voutilad
voutilad / aurads-pyarrow-test.ipynb
Created October 12, 2022 15:38
AuraDS PyArrow Test.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@voutilad
voutilad / remote_import.py
Created January 13, 2022 13:22
Example remote bulk import with neo4j-arrow
#!/bin/env python
## When pointed at an import directory (see https://neo4j.com/docs/operations-manual/current/tools/neo4j-admin/neo4j-admin-import/)
## this script identifies the graph entities and builds the stream of nodes and relationships.
import neo4j_arrow as na
import pyimport as pi # see https://github.com/neo4j-field/neo4j-arrow/blob/bulk-import/src/python/pyimport.py
from time import time
from sys import argv, exit
if __name__ != '__main__':
@voutilad
voutilad / debug.go
Created January 26, 2021 00:16
Debugging a Neo4j query issue
package main
import (
"fmt"
"os"
"github.com/neo4j/neo4j-go-driver/v4/neo4j"
)
// Run the given cypher and print the results
@voutilad
voutilad / badclient.go
Last active November 28, 2020 23:37
POC code for checking Neo4j server bolt protocol behavior after an invalid auth attempt
/*
Build via `go build`...should just work. Use the "-mangle" flag to simulation a
bad password (it just tacks on an extra char). This lets you play with testing
the behavior of good vs bad auth attempts.
NOTE: don't give a bolt uri...just ip/host and port!
Usage of ./authtest:
-host string
hostname:ip for neo4j (default "localhost:7687")
@voutilad
voutilad / gcloud.patch
Created October 14, 2020 21:37
Make gcloud work better on Win10 with OpenSSH
diff --git a/lib/surface/compute/config_ssh.py b/lib/surface/compute/config_ssh.py
index 41bd6794..f9d14517 100644
--- a/lib/surface/compute/config_ssh.py
+++ b/lib/surface/compute/config_ssh.py
@@ -193,7 +193,7 @@ def _CreateAlias(instance_resource):
return '.'.join(parts)
-def _BuildComputeSection(instances, private_key_file, known_hosts_file):
+def _BuildComputeSection(user, instances, private_key_file, known_hosts_file):
@voutilad
voutilad / vmd-thread-safety-07062020-v1.patch
Last active June 8, 2020 10:50
vmd(8) thread safety patch - solves event base corruption so your non-OpenBSD guests live longer, healthier lives
Index: i8253.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/i8253.c,v
retrieving revision 1.31
diff -u -p -u -p -r1.31 i8253.c
--- i8253.c 30 Nov 2019 00:51:29 -0000 1.31
+++ i8253.c 7 Jun 2020 13:53:52 -0000
@@ -30,6 +30,7 @@
#include "i8253.h"
@voutilad
voutilad / vmd-thread-safety-03062020.patch
Created June 3, 2020 13:29
vmd(8) patch to add thread safety to use of libevent (v2)
? parse.c
Index: Makefile
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/Makefile,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 Makefile
--- Makefile 18 Jan 2019 01:24:07 -0000 1.22
+++ Makefile 3 Jun 2020 12:38:27 -0000
@@ -7,6 +7,7 @@ SRCS= vmd.c control.c log.c priv.c proc
SRCS+= vm.c loadfile_elf.c pci.c virtio.c i8259.c mc146818.c
@voutilad
voutilad / sai.js
Last active June 2, 2020 17:17
Quick and dirty example of the Neo4j 4.0 js driver promise api
const neo4j = require('neo4j-driver')
const queryTemplate = `
MATCH (u:User {id: 'some-user-id'})-[:POSTED_ON_2020_05_10|POSTED_ON_2020_05_17]->(p:Post)
RETURN p ORDER BY p.createdAt;
`
let driver = neo4j.driver(
'neo4j://localhost',
neo4j.auth.basic('neo4j', 'password')
@voutilad
voutilad / vmd-thread-safety-02062020.patch
Created June 2, 2020 13:07
Initial patch for hacking vmd(8) into using both multiple device threads as well as protect event_base from corruption
Index: Makefile
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/Makefile,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 Makefile
--- Makefile 18 Jan 2019 01:24:07 -0000 1.22
+++ Makefile 2 Jun 2020 12:43:26 -0000
@@ -7,6 +7,7 @@ SRCS= vmd.c control.c log.c priv.c proc
SRCS+= vm.c loadfile_elf.c pci.c virtio.c i8259.c mc146818.c
SRCS+= ns8250.c i8253.c vmboot.c ufs.c disklabel.c dhcp.c packet.c