Skip to content

Instantly share code, notes, and snippets.

View gburd's full-sized avatar

Greg Burd gburd

View GitHub Profile
# 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)

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).

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.)
# 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
### 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
@gburd
gburd / idea.properties
Last active October 26, 2018 20:24
macOS, Java 8 IntelliJIdea2018.2 config
idea.case.sensitive.fs = true
@gburd
gburd / build-openjdk9-with-shenandoahgc-zero-shark-for-macos-10.13.sh
Last active October 13, 2017 17:20 — forked from bonifaido/build-openjdk9-osx.sh
Build OpenJDK 9 Zero(Shark) with ShenandoahGC on macOS High Sierra 10.13 (bash build-openjdk9-with-shenandoahgc-zero-shark-for-macos-10.13.sh)
#!/bin/bash
# Latest Mercurial, OS X Command Line Tools, JDK 8 and libffi are needed
# WIP, not yet fully functional.
# Targeting macOS High Sierra 10.13 LLVM version: 5.0.0, clang version 5.0.0 (tags/RELEASE_500/final)
# Strict Mode: http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
brew install mercurial
@gburd
gburd / jvm.sh
Last active November 6, 2021 15:53
A script to launch the Java VM (JVM) with some useful configrations.
#!/bin/bash
contains() {
string="$1"
substring="$2"
if test "${string#*$substring}" != "$string"
then
return 0 # $substring is in $string
else
return 1 # $substring is not in $string
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@gburd
gburd / ksreview.txt
Created March 1, 2017 16:31
How to use Kaleidascope for code reivew
Installing KSReview
To install ksreview from the command line, just enter the following:
git config --global alias.ksreview '!f() { local SHA=${1:-HEAD}; local BRANCH=${2:-master}; if [ $SHA == $BRANCH ]; then SHA=HEAD; fi; git difftool -y -t Kaleidoscope $BRANCH...$SHA; }; f'
Using KSReview
To use ksreview while you're on the feature branch, assuming your mainline branch is master, just enter the following at the command line: