Skip to content

Instantly share code, notes, and snippets.

View pmoranga's full-sized avatar

Pmoranga pmoranga

View GitHub Profile
@pmoranga
pmoranga / munin_-_lvm_snap_used
Created June 20, 2011 14:23
Graph % of used space of LVM Snapshot
#!/bin/bash
#
# Plugin to monitor the % of allocated area of a LVM snapshot
#
# Parameters:
#
# config
# autoconf
#
# Configuration variables
@pmoranga
pmoranga / mysql_rename_tablespace.sh
Created March 9, 2012 10:36
Shell script to rename database. It creates a new database, and rename table by table from the old database to the new database. Views can't be renamed
#!/bin/bash
###############################
# Will move all Mysql tables from one database to a new database
[ "$#" -lt 2 ] && echo "usage: $(basename $0) OLD_DB NEW_DB MYSQL_AUTH_OPTS" && exit 1
SRCDB=$1
DSTDB=$2
shift
shift
#!/bin/bash
if [ "n$2" = "n" -o ! -e "$1" ] ; then
echo "usage: $(basename $0) PATH_TO_LV_SOURCE NAME_OF_NEW_LV "
echo -e "\nEx: $(basename $0) /dev/VG02_ssd/CentOS6 vm03-d1"
exit 1
fi
SOURCE=$1
DEST=$2
@pmoranga
pmoranga / mk-slave-find.patch
Created February 20, 2014 10:59
Patch for Maatkit tool mk-slave-find so it will show the hostname of the server also on the hierarchy list. Useful if you do not have reverse dns for IP's
--- /usr/local/bin/mk-slave-find.original 2014-02-20 11:54:39.000000000 +0100
+++ /usr/local/bin/mk-slave-find 2014-02-20 11:58:21.000000000 +0100
@@ -2907,6 +2907,7 @@
push @lines, ['Version', $vars->{version}->{value}];
push @lines, ['Server ID', $vars->{server_id}->{value}];
+ push @lines, ['Hostname', $vars->{hostname}->{value}];
my $dhms = secs_to_time($stats->{Uptime}->{value}) || '';
my $started = ts(time - $stats->{Uptime}->{value}) || '';
@pmoranga
pmoranga / create_my_snapshots.py
Created March 19, 2014 12:41
Create EC2 snapshot from all volumes connected in the VM itself.
#!/usr/bin/python
from boto.ec2.connection import EC2Connection
from boto.utils import get_instance_metadata
from datetime import datetime
import sys
conn = EC2Connection('AUTH_KEY', 'SECRET_KEY')
description = 'Created by crontab at ' + datetime.today().isoformat(' ')
@pmoranga
pmoranga / local_snap.py
Last active August 29, 2015 14:09
AWS - EC2 - Create snapshot from all volumes attached to host. also notify deadmanssnitch.com about the procedure replace xxxxxxxxxxx, yyyyyyyyyyyy and zzzzzzzzzz with appropriate values
#!/usr/bin/python
from boto.ec2.connection import EC2Connection
from boto.utils import get_instance_metadata
from datetime import datetime
import sys
conn = EC2Connection('xxxxxxxxxxxx', 'yyyyyyyyyyyyyyy')
hostname = socket.gethostname()
@pmoranga
pmoranga / README.md
Last active April 8, 2020 07:18 — forked from blackjid/README.md
Raspberry pi dashboard rpi screens

Raspberry pi dashboard

This is what we did to setup a few dashboards at platanus

You'll need

  • Raspberry Pi
  • Dashing Service
  • Wifi stick (optional)
<koken:if true="settings.albums_index_show_title">
<h4>
<koken:load style="margin-left: 0.2em;">
{{ album.title }} <!-- Prints SET title -->
</koken:load>
</h4>
<p>Work
<koken:load>
@pmoranga
pmoranga / Vagrantfile
Created September 28, 2015 21:23 — forked from johnpbloch/Vagrantfile
Puppet awesomesauce for Vagrant
config.vm.provision :puppet do |puppet|
# Add a folder in your root named .ppt
puppet.manifests_path = ".ppt/manifests"
# vagrant.pp is your main manifest and goes in .ppt/manifests
puppet.manifest_file = "vagrant.pp"
# Add puppet modules in .ppt/modules as git submodules; they will be pre-installed in Vagrant this way
puppet.module_path = ".ppt/modules"
# Config files, etc. go in .ppt/files. fileserver.conf (see below) defines the path for puppet to add
# when looking for files. That way, you can reference files with puppet:// protocols. Make sure you
# add the directory defined in fileserver.conf as a shared directory in the main Vagrantfile config
@pmoranga
pmoranga / puppet-firewall-docker.pp
Created February 8, 2016 23:55
Make puppetlabs-firewall works with docker smoothly
class my_fw::pre {
# Disable due to selective purges of firewallchain
# resources { "firewall":
# purge => true
# }
# Avoid removing Docker rules:
firewallchain { 'FORWARD:filter:IPv4':
purge => true,