Skip to content

Instantly share code, notes, and snippets.

View ipeacocks's full-sized avatar
🐕
Meow

Bruce ipeacocks

🐕
Meow
View GitHub Profile
$ cat alertmanager-secret-k8s.yaml
apiVersion: v1
data:
alertmanager.yaml: ALERTMANAGER_CONFIG
kind: Secret
metadata:
name: alertmanager-main
namespace: monitoring
type: Opaque
$ sed "s/ALERTMANAGER_CONFIG/$(cat alertmanager.yaml | base64 -w0)/g" alertmanager-secret-k8s.yaml | kubectl apply -f -
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), 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(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
#!/bin/bash
TMPFCMD="/tmp/cmd.tmp"
dialog --title 'Execute command' --menu 'Chose program to launch:' 0 0 0 \
l 'ls -la' \
p pwd \
d date \
u 'uname -a' \
w whoami 2> $TMPFCMD
CMD2RUN=$(cat $TMPFCMD)
@ipeacocks
ipeacocks / prometheus.md
Created July 26, 2018 08:30 — forked from petarnikolovski/prometheus.md
Prometheus 2.x installation on Ubuntu 16.04 server.

Installing Prometheus on Ubuntu 16.04

This gist is a compilation of two tutorials. You can find the original tutorials here and here. What should you know before using this? Everything can be executed from the home folder. For easier cleanup at the end you can make directory where you'll download everything, and then just use rm -rf .. Although, you should be careful. If some strange bugs arise unexpectedly somewhere sometimes, just keep in mind that some user names have underscores in them (this is probably nothing to worry about).

Create Users

sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Prometheus Monitoring User" prometheus
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Node Exporter User" node_exporter
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Alertm
@ipeacocks
ipeacocks / curl.md
Created October 5, 2018 15:34 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ipeacocks
ipeacocks / dh-diagram.svg
Created April 27, 2019 20:21 — forked from Lewiscowles1986/dh-diagram.svg
SSH with asymmetric key UML Sequence
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pulumi
from pulumi_aws import ec2, get_availability_zones
import utils
# read local config settings
config = pulumi.Config()
private_subnet_cidrs = config.require_object("private_subnet_cidrs")
@ipeacocks
ipeacocks / utils.py
Created May 21, 2020 19:52
utils.py
from pulumi_aws import get_availability_zones
def get_aws_az(amount):
zones = get_availability_zones()
return zones.names[:amount]
from pulumi import export, ResourceOptions, Config, StackReference, get_stack
import pulumi_aws as aws
import json
# Read local config settings
config = Config()
# ---------------