Skip to content

Instantly share code, notes, and snippets.

View tchellomello's full-sized avatar

Marcelo Mello tchellomello

View GitHub Profile
@tchellomello
tchellomello / pg_dealocks.sh
Created October 7, 2016 15:28
PostgreSQL deadlocks detection
#!/bin/bash
## Monitor the PostgreSQL database for deadlock queries
### https://wiki.postgresql.org/wiki/Lock_Monitoring
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/opt/rh/postgresql92/root/usr/bin"
PG_VERSION=$(su - postgres -c "psql -c 'select version();'" | grep "^ PostgreSQL" | cut -f 3 -d ' ' | cut -f1 -d'.')
LOGFILE="/var/log/pg_monitor_deadlocks.log"
@tchellomello
tchellomello / passenger_monitor.sh
Last active October 6, 2016 21:53
Passenger Monitor Script
#!/bin/bash
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
TIMESTAMP=$(date +%Y_%m_%d-%H_%M_%S)
LOGFILE="/var/log/passenger_stats.log"
echo "--------START $TIMESTAMP---------------" >> $LOGFILE
echo "" >> $LOGFILE
@tchellomello
tchellomello / nest.py
Created October 1, 2016 16:50
Test - HA - sensor/nest.py
"""
Support for Nest Thermostat Sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.nest/
"""
import logging
from itertools import chain
import voluptuous as vol
@tchellomello
tchellomello / nest.py
Created October 1, 2016 16:48
Test fix remove epoach - HA (deps/nest.py)
# -*- coding:utf-8 -*-
import collections
import copy
import datetime
import time
import os
import uuid
import weakref
"""
Support for WUnderground weather service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.wunderground/
"""
from datetime import timedelta
import logging
import requests
CERT=/etc/pki/katello/certs/katello-apache.crt
KEY=/etc/pki/katello/private/katello-apache.key
#create exchange:
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b "amqps://localhost:5671" add exchange topic event --durable
#view exchange:
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b "amqps://localhost:5671" exchanges
#create queue:
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b 'amqps://localhost:5671' add queue katello_event_queue --durable
@tchellomello
tchellomello / delete_pending_tasks.py
Created September 21, 2016 20:35
Archive pending actions
#!/usr/bin/python
import xmlrpclib
SATELLITE_URL = "http://orbital.usersys.redhat.com/rpc/api"
SATELLITE_LOGIN = "admin"
SATELLITE_PASSWORD = "redhat"
server = xmlrpclib.Server(SATELLITE_URL, verbose=0)
token = server.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)