Skip to content

Instantly share code, notes, and snippets.

Avatar

Toby McLaughlin jarpy

  • Elastic
  • Adelaide
View GitHub Profile
@jarpy
jarpy / pip-install-pyo.sh
Last active Sep 27, 2022
Install Pyo on ARM (M1) Mac
View pip-install-pyo.sh
#!/bin/bash
# These libraries are required when compiling the C extension for Pyo.
libs=(liblo libsndfile portaudio portmidi)
# Let the C compiler know where to find the headers and library files.
CFLAGS=""
for lib in "${libs[@]}"; do
CFLAGS+="-I/opt/homebrew/opt/${lib}/include -L/opt/homebrew/opt/${lib}/lib "
done
View jarpy_cdktf_main.py
from cdktf import App
from os import environ
from typing import Final
from terrazzo.cdktf.stack import TerrazzoStack
if __name__ == "__main__":
# Check if we are running under test.
TERRAZZO_TESTING: Final[bool] = (
environ.get("TERRAZZO_TESTING", "false").lower() == "true"
)
View cdktf_debug.txt
cdktf debug
language: python
cdktf-cli: 0.11.2
node: v18.3.0
cdktf: 0.11.2
constructs: 10.1.42
jsii: 1.61.0
terraform: 1.2.2
arch: x64
os: linux 5.15.49-1-lts
View riemann-live-hacking.md

Riemann Live Hacking

This document is a guide to "live hacking" a running Riemann instance. Riemann exposes an [nREPL], allowing us to connect to it, live in production, and run Clojure code inside its brain.

This document can be considered a rudimentary form of literate Clojure:

  • Open it in your editor
  • Connect your editor REPL client to tcp/5557 on the Riemann instance
View respawn.lua
local function groupIsDead(groupName) -- a certain bug hasn't been fixed, so I have to use this instead.
if (Group.getByName(groupName) and ( Group.getByName(groupName):isExist() == false or #Group.getByName(groupName):getUnits() < 1)) or not Group.getByName(groupName) then
return true
end
return false
end
if groupIsDead('TEST1') then
mist.respawnGroup('TEST1', true)
end
@jarpy
jarpy / gist:08b2364f577dfcfddb0fd645af6f67bd
Last active Dec 23, 2019
Disable MS Office keyboard shortcut.
View arch-bootstrap
#!/bin/bash
set -xeuo pipefail
function install() {
pacman --sync --noconfirm $@
}
luks_volume_uuid=$(blkid --match-tag UUID --output value /dev/nvme0n1p2)
ping -c1 google.com || dhclient eno1
@jarpy
jarpy / java-process
Created Dec 5, 2018
Investigation of puppet-logstash#381
View java-process
Failure:
/bin/java -Dfile.encoding=UTF-8 -Djava.awt.headless=true -XX:+DisableExplicitGC -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 "-Xms1g -Xmx1g" -Xms256m -Xss2048k -Djffi.boot.library.path=/usr/share/logstash/vendor/jruby/lib/jni -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -noverify -Djruby.compile.invokedynamic=false -Xbootclasspath/a:/usr/share/logstash/vendor/jruby/lib/jruby.jar -classpath : -Djruby.home=/usr/share/logstash/vendor/jruby -Djruby.lib=/usr/share/logstash/vendor/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main -X-C /usr/share/logstash/lib/pluginmanager/main.rb install logstash-filter-translate
@jarpy
jarpy / 301
Created Nov 26, 2018
Docker Hub Errors 2018-11-26
View 301
$ while docker pull alpine; do echo; done
Using default tag: latest
latest: Pulling from library/alpine
Digest: sha256:621c2f39f8133acb8e64023a94dbdf0d5ca81896102b9e57c0dc184cadaf5528
Status: Image is up to date for alpine:latest
Using default tag: latest
latest: Pulling from library/alpine
Digest: sha256:621c2f39f8133acb8e64023a94dbdf0d5ca81896102b9e57c0dc184cadaf5528
Status: Image is up to date for alpine:latest
View docker-compose.yml
version: '3.5'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.2
ports:
- "9200:9200"
environment:
ES_JAVA_OPTS: "-Xmx2g -Xms2g"