Skip to content

Instantly share code, notes, and snippets.

View k8s-pi.md
@elleryq
elleryq / dump-gsettings.py
Created Apr 10, 2015
dump all gsettings. It is same as 'gsettings list-recursively'
View dump-gsettings.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""dump gsettings"""
from __future__ import print_function
from subprocess import check_output
def get_schemas():
output = check_output(['gsettings', 'list-schemas'])
schemas = output.split('\n')
@solarce
solarce / ec2.tf
Last active Mar 25, 2020
terraform.io example template for ec2 instance with tags
View ec2.tf
# The various ${var.foo} come from variables.tf
# Specify the provider and access details
provider "aws" {
region = "${var.aws_region}"
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
}
@rothgar
rothgar / main.yml
Last active May 1, 2021
Generate /etc/hosts with Ansible
View main.yml
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@arantius
arantius / simple-rrd-merge.py
Created Mar 23, 2012
A very simple script to merge multiple RRD files, since none of those available seem to work.
View simple-rrd-merge.py
#!/usr/bin/env python
"""Simple script to merge multiple RRD files together.
Accepts any number of RRD file names as arguments. Produces an "rrdtool dump"
style file on stdout. The last RRD file should have a slot for every possible
record in the resulting merged RRD.
Run something like:
$ python simple-merge-rrd.py filea.rrd fileb.rrd filec.rrd | \