Skip to content

Instantly share code, notes, and snippets.

View gburd's full-sized avatar

Greg Burd gburd

View GitHub Profile
@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:
https://github.com/jsnell/ratas.git :: Timer Wheel in C++ :: MacOS build
cmake . -G Ninja -DCMAKE_CXX_COMPILER=g++-5 -DCMAKE_CC_COMPILER=gcc-5 -DCMAKE_MAKE_PROGRAM=$(which ninja)
@gburd
gburd / README.md
Created December 3, 2016 01:31
Hardening C code at compile time

Hardening flags enabled by default

format Adds the -Wformat -Wformat-security -Werror=format-security compiler options. At present, this warns about calls to printf and scanf functions where the format string is not a string literal and there are no format arguments, as in printf(foo). This may be a security hole if the format string came from untrusted input and contains %n.

stackprotector Adds the -fstack-protector-strong --param ssp-buffer-size=4 compiler options. This adds safety checks against stack overwrites rendering many potential code injection attacks into aborting situations. In the best case this turns code injection vulnerabilities into denial of service or into non-issues (depending on the application).

fortify Adds the -O2 -D_FORTIFY_SOURCE=2 compiler options. During code generation the compiler knows a great deal of information about buffer sizes (where possible), and attempts to replace insecure unlimited length buffer function calls with length-limited ones. This is especially useful for

@gburd
gburd / cat-chrome.sh
Created October 18, 2016 14:29
Ubuntu 16.06 - rc.local tricks/tips
# Ensure that Google Chrome's script terminates subprocesses (like 'cat') properly
( if ! grep -q 'trap \"trap - SIGTERM && kill -- -$$\" SIGINT SIGTERM EXIT' /opt/google/chrome/google-chrome
then
LINE=$(( $(awk '$0 ~ "exec 2" {print NR}' /opt/google/chrome/google-chrome) + 1))
/bin/ed /opt/google/chrome/google-chrome <<EOF
${LINE}i
trap "trap - SIGTERM && kill -- -\$\$" SIGINT SIGTERM EXIT
.
w
q