Skip to content

Instantly share code, notes, and snippets.

View gburd's full-sized avatar

Greg Burd gburd

View GitHub Profile
gburd / skip_list.c
Created March 21, 2024 17:46 — forked from zhpengg/skip_list.c
skiplist implementation in c
/* Skip Lists: A Probabilistic Alternative to Balanced Trees */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
typedef struct snode {
int key;
gburd / shell.txt
Created October 6, 2023 17:57
Symas OpenLDAP in a container (thanks Bitnami!)
docker buildx build --format docker --progress=plain --no-cache --rm --platform linux/x86_64 --load -t symas/openldap:latest .
mkdir /tmp/ldap
chmod 0777 /tmp/ldap
clear; sudo rm -rf /tmp/ldap/{.ldap_setup_complete,slapd.d,data}; docker run --rm -e BITNAMI_DEBUG=true --name=symas-openldap -p 1389:1389 -p 1639:1639 --volume /tmp/ldap:/bitnami/openldap --user 1001 symas/openldap:latest
gburd@floki ~/w/c/o/2/debian-11 (main)> sudo rm -rf /tmp/ldap/{.ldap_setup_complete,slapd.d,data}; docker run --rm -e BITNAMI_DEBUG=true --name=symas-openldap -p 1389:1389 -p 1639:1639 --volume /tmp/ldap:/bitnami/openldap --user 1001 symas/openldap:latest
17:55:10.09 INFO ==> ** Starting LDAP setup **
17:55:10.12 INFO ==> Validating settings in LDAP_* env vars
-- This is done once per database instance.
CREATE EXTENSION pg_partman SCHEMA partman;
GRANT ALL ON SCHEMA partman TO partman;
gburd /
Created February 15, 2023 15:33
Easy annotation to add OpenTelemetry into Python projects
## This file is a direct import of code from an MIT licensed project:
## digma-ai/opentelemetry-instrumentation-digma
import inspect
import types
from functools import wraps
gburd / FlattenArray.ex
Created June 8, 2022 16:59
flatten array elixir
defmodule FlattenArray do
@doc """
Accept a list and return the list flattened without nil values.
## Examples
iex> FlattenArray.flatten([1, [2], 3, nil])
iex> FlattenArray.flatten([nil, nil])
gburd / idea.vmoptions
Last active June 8, 2022 16:54
IntelliJ 2021.2.4 config
gburd /
Last active October 5, 2021 14:42 — forked from bryanhunter/
This script will install dependencies and then build and install erlang using kerl on Ubuntu
# This script will install dependencies then build and install erlang using kerl
# Pull this file down, make it executable and run it with sudo
# wget
# chmod u+x
# sudo ./
# Version: 17.1
# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
gburd /
Last active August 14, 2020 14:59
Container sending data to host using net=bridge mode (e.g. container to localhost)

Rather than I think that the route to the Docker host is always available within the container in bridge mode as the default route, so you just have to find it, here's how:

$ nc -lu 8125
$ docker run --rm -it ubuntu:latest /bin/bash
# apt install net-tools netcat
# export DOCKER_HOST_IP=$(route -n | awk '/UG[ \t]/{print $2}')
# echo 'Over here!' | nc -w 0 -u $DOCKER_HOST_IP 8125

And so we have the container send data over UDP to the default route which is the host (when docker container is run with net=bridge, the default).

x9rwjel0WrMcwU4 mXj4FLkBRNa71Nl dLmWzQbwVFGRYCM lUngX6ghQHoGfAl
sm1kCQIbDQIfiUT QxjpGlm2E55TCKq 6Xr2MZHgg6ejNmm WrN4fnkbSrWkoEj
FrUC2kOAGjq4QDl PisUBWVV6pvbmqy cPf7F.