Skip to content

Instantly share code, notes, and snippets.

@Kenterfie
Kenterfie / terradiff
Created August 1, 2023 18:43
Small python script to make terraform plan outputs for terraform helm_release values better readable
#!/bin/env python3
#
# TERRADIFF
#
# Small script to convert EOT diffs into single line diffs to make them easier to read
#
# How to use
# terraform plan | terradiff
#
@darkshade9
darkshade9 / logstash-neo4j-querylog.txt
Last active November 7, 2019 12:10
neo4j query log grok
if [type] == "neo4j_logs" {
if [source] == "/var/log/neo4j/query.log" {
grok {
match => ["message", "%{TIMESTAMP_ISO8601:datetime} %{WORD:severity} +%{NUMBER:ms} ms: %{NOTSPACE:session-type} %{WORD:protocol} %{WORD:remoteUser} %{NOTSPACE:driver}/(\[)?%{DATA:driver-version}(\])? client/%{IP:clientip}:%{NUMBER:clientport} server/%{IP:serverip}:%{NUMBER:serverport}> %{WORD:remoteUser} - %{GREEDYDATA:query} - (%{GREEDYDATA:parameters})? - {}"]
match => ["message", "%{TIMESTAMP_ISO8601:datetime} %{WORD:severity} +%{NUMBER:ms} ms: %{NOTSPACE:session-type} %{WORD:protocol} %{IP:clientip} %{GREEDYDATA:endpoint} %{WORD:remoteUser} - %{GREEDYDATA:query} - (%{GREEDYDATA:parameters})? - {}"]
}
}
}
@cherti
cherti / alert.sh
Created December 9, 2016 13:47
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@noonat
noonat / coreos-virtualbox.md
Last active February 10, 2023 22:00
Installing CoreOS on VirtualBox
  • Download and install VirtualBox.
  • Download the CoreOS ISO
  • Create a new VM in VirtualBox
    • For the OS, Other Linux, 64-bit should be fine
    • Give the VM 1gb of memory, like your physical hardware has.
    • Create a disk of whatever size you want. I made a VMDK file that could expand dynamically up to 8gb.
  • Mount the ISO in the VM
    • Right click on the VM and click settings
  • Go to the storage tab
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 19, 2025 04:39
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'