Skip to content

Instantly share code, notes, and snippets.

View jarpy's full-sized avatar
💚

Nina Dowland jarpy

💚
  • Elastic
  • Adelaide
  • 10:18 (UTC +09:30)
View GitHub Profile
@jarpy
jarpy / gist:d8bc2f353f365490f485
Created March 11, 2015 23:32
Send statsd metrics from the shell using only echo and Netcat.
# Counter
echo -n 'some.metric.namespace:1|c' | nc -u -q0 localhost 8125
# Gauge
echo -n 'some.metric.namespace:100|g' | nc -u -q0 localhost 8125
# Timer
echo -n 'some.metric.namespace:342|ms' | nc -u -q0 localhost 8125
@jarpy
jarpy / pip-install-pyo.sh
Last active September 27, 2022 22:05
Install Pyo on ARM (M1) Mac
#!/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
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"
)
@jarpy
jarpy / requirements.txt
Last active June 30, 2022 06:28
Serverless Elasticsearch Curator for AWS Lambda
certifi==2016.8.8
elasticsearch-curator==4.0.6
PyYAML==3.11
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
version: '3.5'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.2
ports:
- "9200:9200"
environment:
ES_JAVA_OPTS: "-Xmx2g -Xms2g"

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
@jarpy
jarpy / respawn.lua
Last active September 16, 2020 21:27
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 December 23, 2019 21:50
Disable MS Office keyboard shortcut.
#!/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