Skip to content

Instantly share code, notes, and snippets.

View JessicaGreben's full-sized avatar

Jessica Grebenschikov JessicaGreben

  • Aerospike
  • San Francisco, CA
View GitHub Profile
@JessicaGreben
JessicaGreben / bench_test.go
Last active January 25, 2020 17:11
insertion sort with tests and benchmarks
package main
import (
"math/rand"
"testing"
"time"
)
const (
random = 0
package main
// stringMatch returns a list of indexes of the starting positions of the
// matching substr, does not count overlapping matches.
// worst case runtime: len(str) * len(substr)
// pathological inputs would be a substr that doesn't matches but has many similar chars
// so that for every char in str we would iterate thru all chars in the substr
// ex: aaaaaaaaa, aaad
// typical performance len(str) plus however many occurrences of the matching first chars of substr
func bruteStringMatch(str, substr string) []int {
@JessicaGreben
JessicaGreben / db-trace
Last active February 26, 2020 19:39
debug trace endpoint
From a production satellite:
1. Port forward from the pod
I=0; for API in $(kubectl -n satellite get pods | rg api | awk '{print $1}'); do I=$(($I+1)); kubectl -n satellite port-forward $API 5999$I:5999 & done
2. Hit the db trace debug endpoint
curl 127.0.0.1:5999{1,2,3}/debug/run/trace/db
3. Perform desired uplink operation, i.e. upload/download/etc
apiVersion: apps/v1
kind: Deployment
metadata:
name: tinkerbench
namespace: aerospike-graph
labels:
app: tinkerbench
spec:
replicas: 1
selector:
# https://pypi.org/project/gremlinpython/
from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.process.traversal import IO
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
import ssl
import datetime
import sys
if __name__ == '__main__':