Skip to content

Instantly share code, notes, and snippets.

@Andor
Andor / check_postgres_replication.py
Created April 18, 2012 11:53
Nagios plugin to check PostgreSQL 9 streaming replication lag.
#!/usr/bin/env python
"""
Nagios plugin to check PostgreSQL 9 streaming replication lag.
Requires psycopg2 and nagiosplugin (both installable with pip/easy_install).
See: http://bucardo.org/check_postgres/check_postgres.pl.html#hot_standby_delay
MIT licensed:
Copyright (c) 2010 Jacob Kaplan-Moss. All rights reserved.
@Andor
Andor / default
Last active April 20, 2022 14:08
vaultbot.sls
{% for key, value in options.iteritems() %}
{{ key|upper }}="{{ value }}"
{% endfor %}
@Andor
Andor / kafka-lag.yaml
Created January 18, 2019 08:49
prometheus alerts group for kafka producer/consumer lag
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: prometheus-kafka-lagging
labels:
ksonnet.io/component: prometheus-rules
prometheus: k8s
role: alert-rules
namespace: monitoring
@Andor
Andor / teamcity-download.py
Last active September 9, 2019 09:38
Script to download all TeamCity configuration in Kotlin
#!/usr/bin/env python
import requests
from requests.auth import HTTPBasicAuth
from urllib.parse import urljoin
import os
import io
import zipfile
# this file should contain teamcity base url
@Andor
Andor / devicemapper.sh
Last active June 20, 2019 11:21
script to scrape metrics from devicemapper, useful to use as metadata source
#!/bin/bash
set -e
set -o pipefail
prometheus_format=${DEVICEMAPPER_PROMETHEUS:-true} # influxdb format otherwise
function format_labels {
first=true
echo "$*" | tr , "\\n" | while read -r l; do
@Andor
Andor / cloud-init.template.yaml
Created June 26, 2019 12:55
teamcity-agent with logging to google cloud stackdriver
#cloud-config
package_update: true
package_upgrade: true
write_files:
- path: /etc/default/teamcity-agent
owner: root:root
permissions: '0644'
content: |
PLAY [127.0.0.1] ***************************************************************
Tuesday 09 July 2019 16:42:06 +0000 (0:00:00.111) 0:00:00.111 **********
TASK [docker-py] ***************************************************************
changed: [127.0.0.1]
Tuesday 09 July 2019 16:42:11 +0000 (0:00:05.196) 0:00:05.307 **********
TASK [run container] ***********************************************************
changed: [127.0.0.1]
Tuesday 09 July 2019 16:42:13 +0000 (0:00:01.632) 0:00:06.940 **********
@Andor
Andor / ansible-mysql-docker.yaml
Created October 7, 2019 16:01
Ansible Mysql Docker
- name: run mysql with docker container and wait for healthcheck pass
docker_container:
name: my-mysql
hostname: my-mysql
image: mysql/mysql-server # this image has healthchecks
env: "{{ mysql_docker_env }}"
volumes:
- "{{ mysql_data_directory }}/data:/var/lib/mysql"
- "{{ mysql_data_directory }}/logs:/var/log/mysqld"
- /var/run/mysqld:/var/run/mysqld # we will have ability to connect to mysql from host machine
@Andor
Andor / .gitlab-ci.yml
Last active February 28, 2023 15:03
terraform .gitlab-ci.yml
---
variables:
terraform_image: terraform-vault-jq
default:
image:
name: $terraform_image
cache:
key: terraform
paths:
@Andor
Andor / cc2538-and-openocd.md
Created November 10, 2020 07:56 — forked from hwhw/cc2538-and-openocd.md
Flashing CC2538 using OpenOCD (&UART)

Flashing CC2538 using OpenOCD (&UART)

Problem description

CC2538 SoCs are Cortex-M4 based SoCs by Texas Instruments for 802.15.4 PAN networking, especially for Zigbee communication using their Zigbee Stack solution. It also is a solid foundation for hobbyist-grade solutions involving Zigbee communication, especially for running a self-implemented Zigbee coordinator (often called "Zigbee gateway" in commercial distribution of similar tech). Software-wise, this is usually done by running "ZNP" (Zigbee Network Processor) firmware on the SoC and using a separate controller/computer to act as the "ZAP" (Zigbee Application Processor). In a hobbyist setting, the former is usually a cheap module from china containing the chip, capacitors and an antenna or antenna connector, while the latter is e.g. a Raspberry Pi or an Intel NUC or whatever floats your boat. The API between both components is specified and so the software side on the ZAP does not need to bother with Zigbee communication states but can act on a