Skip to content

Instantly share code, notes, and snippets.

View tchellomello's full-sized avatar

Marcelo Mello tchellomello

View GitHub Profile
@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)
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
"""
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
@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
@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 / 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 / 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 / hotfix_bz1374038.diff
Last active October 12, 2016 20:32
Hotfix bz#1374038
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/content_facet_host_extensions.rb.orig 2016-10-10 16:46:52.578790963 -0400
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/content_facet_host_extensions.rb 2016-10-10 16:48:10.677468395 -0400
@@ -23,11 +23,11 @@
has_many :applicable_errata, :through => :content_facet
scoped_search :in => :content_view, :on => :name, :complete_value => true, :rename => :content_view
- scoped_search :in => :content_facet, :on => :content_view_id, :rename => :content_view_id
+ scoped_search :in => :content_facet, :on => :content_view_id, :rename => :content_view_id, :only_explicit => true
scoped_search :in => :lifecycle_environment, :on => :name, :complete_value => true, :rename => :lifecycle_environment
- scoped_search :in => :content_facet, :on => :lifecycle_environment_id, :rename => :lifecycle_environment_id
@tchellomello
tchellomello / webrick-ssl.rb
Created October 21, 2016 15:48
Webrick SSL Tests
#!/usr/bin/env ruby
#####
##### [root@sat6mmello ~]# openssl s_client -CAfile /etc/foreman-proxy/ssl_ca.pem -connect $(hostname):8444
#!/usr/bin/env ruby
require 'rubygems'
require 'webrick'
require 'webrick/https'
# /etc/httpd/conf.d/05-foreman-ssl.conf
PassengerAppRoot /usr/share/foreman
PassengerRuby /usr/bin/tfm-ruby
PassengerMinInstances 5
PassengerStartTimeout 600
PassengerPreStart https://<FQDN>
# https://www.phusionpassenger.com/library/config/apache/optimization/
# /etc/httpd/conf.d/passenger_tunnings.conf