Skip to content

Instantly share code, notes, and snippets.

View gburd's full-sized avatar

Greg Burd gburd

View GitHub Profile
View asked_for_date_partitioning.sql
-- This is done once per database instance.
BEGIN;
CREATE SCHEMA partman;
CREATE EXTENSION pg_partman SCHEMA partman;
COMMIT;
BEGIN;
CREATE ROLE partman WITH LOGIN;
GRANT ALL ON SCHEMA partman TO partman;
@gburd
gburd / trace_decorator.py
Created February 15, 2023 15:33
Easy annotation to add OpenTelemetry into Python projects
View trace_decorator.py
## This file is a direct import of code from an MIT licensed project:
## digma-ai/opentelemetry-instrumentation-digma
##
## https://github.com/digma-ai/opentelemetry-instrumentation-digma/blob/main/LICENSE
## https://raw.githubusercontent.com/digma-ai/opentelemetry-instrumentation-digma/main/src/opentelemetry/instrumentation/digma/trace_decorator.py
##
import inspect
import types
from functools import wraps
@gburd
gburd / FlattenArray.ex
Created June 8, 2022 16:59
flatten array elixir
View FlattenArray.ex
defmodule FlattenArray do
@doc """
Accept a list and return the list flattened without nil values.
## Examples
iex> FlattenArray.flatten([1, [2], 3, nil])
[1,2,3]
iex> FlattenArray.flatten([nil, nil])
[]
"""
@gburd
gburd / idea.vmoptions
Last active June 8, 2022 16:54
IntelliJ 2021.2.4 config
View idea.vmoptions
-Xms128m
-Xmx2048m
-XX:ReservedCodeCacheSize=512m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-ea
-Dsun.io.useCanonCaches=false
@gburd
gburd / build-erlang.sh
Last active October 5, 2021 14:42 — forked from bryanhunter/build-erlang.sh
This script will install dependencies and then build and install erlang using kerl on Ubuntu
View build-erlang.sh
#!/bin/bash
# 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 https://gist.githubusercontent.com/bryanhunter/adbd9c8d9fb2f6366eee/raw/build-erlang.sh
# chmod u+x build-erlang.sh
# sudo ./build-erlang.sh
#
# Version: 17.1
View init.coffee
# 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
gburd / README.md
Last active August 14, 2020 14:59
Container sending data to host using net=bridge mode (e.g. container to localhost)
View README.md

Rather than 127.0.0.1 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).

View gist:f3c5192624e5065b8d3ab3a144488617
BEGIN MESSAGE.
x9rwjel0WrMcwU4 mXj4FLkBRNa71Nl dLmWzQbwVFGRYCM lUngX6ghQHoGfAl
sm1kCQIbDQIfiUT QxjpGlm2E55TCKq 6Xr2MZHgg6ejNmm WrN4fnkbSrWkoEj
Pon8DjwKDDNeBMF LR1CalqETQ6GazG gjtXbI1R7rMCYFL VH8nuYoSGbfCDb1
FrUC2kOAGjq4QDl PisUBWVV6pvbmqy cPf7F.
END MESSAGE.
@gburd
gburd / install-beats.sh
Last active September 17, 2019 16:47 — forked from EikeDehling/install-beats.sh
Install filebeat & metricbeat on debian (as root) and ship data to Humio's cloud hosted service for log and metric management (a replacement for Splunk, Elasticsearch, Loggly, etc.)
View install-beats.sh
# Install filebeat & metricbeat
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
apt-get update
apt-get install filebeat metricbeat
# Configure filebeat
cat >/etc/filebeat/filebeat.yml <<EOL
filebeat.inputs:
@gburd
gburd / sysctl.conf
Created January 5, 2019 02:43 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
View sysctl.conf
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2