Skip to content

Instantly share code, notes, and snippets.

@jaimegago
jaimegago / gist:11229750
Last active October 23, 2022 23:31
Grafana Dashboards Backups
#!/usr/bin/python -tt
#
import datetime
import json
import logging
import logging.handlers
import optparse
import os
import re
import shutil
@jaimegago
jaimegago / gist:6926304
Last active December 25, 2015 05:39
A script that detects unmodified templates Ansible files and adds the ansible_managed commented out. Deals with XML files comment syntax by reading first line.
#!/usr/bin/python
#A script that detects unmodified templates Ansible files and adds the ansible_managed commented
# out. Deals with XML files comment syntax by reading first line.
import fileinput
import os
import re
#Defining different headers as commenting syntax is different for XML
@jaimegago
jaimegago / shell_vim_prov
Last active January 4, 2016 22:55
A script I use for local provisioning of my bash profile in vagrant, does a bunch of stuff for the prompt and for vim
#!/bin/bash
function cinfo() {
COLOR='\033[01;33m' # bold yellow
RESET='\033[00;00m' # normal white
MESSAGE=${@:-"${RESET}Error: No message passed"}
echo -e "${COLOR}${MESSAGE}${RESET}"
}
##
cinfo "Local Provisioning detected"
#A couple of tools that are not on my base box
@jaimegago
jaimegago / mailman lists subscribers
Created November 29, 2012 23:01
A very basic 1 shot python script that uses mailman CLI to send the subscribers list of all mailing list
#!/usr/bin/python
#
#
# a simple script to use the mailman cli
# to send via email the list of members of each mailman list
#
#
import smtplib
import string
import commands
@jaimegago
jaimegago / gist:3896119
Created October 15, 2012 22:38
one liner we use for release rpm tag
git log -1 --pretty=format:"%ad %h" --date=short|sed s/'[[:space:]]'/."$(git log --oneline|wc -l)"git/|sed s/-//g
YYYYMMDD.$NUMBER_OF_COMMITS.git$COMMIT_HASH_SHORT
example output: 20121015.722git48b7147
We use this to package our JAVA based snapshot as an extension of http://fedoraproject.org/wiki/Packaging:NamingGuidelines#Snapshot_packages .
Adding the number of commits before the "git" allows proper ordering of packages in yum database.