Skip to content

Instantly share code, notes, and snippets.

View tchellomello's full-sized avatar

Marcelo Mello tchellomello

View GitHub Profile
@tchellomello
tchellomello / wunderground.py
Created November 30, 2016 08:36
Test code to support language on HA
"""
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 re
@tchellomello
tchellomello / amcrest.py
Last active November 24, 2016 04:10
V1.0 amcrest camera for Home Assistant
"""
This component provides basic support for Amcrest IP cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.amcrest/
"""
import logging
import voluptuous as vol
from amcrest import AmcrestCamera
@tchellomello
tchellomello / wunderground.py
Last active November 25, 2016 19:19
Troubleshooting "Check WUnderground API update ('you must supply a key',)"
"""
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 / 90-convert_grub2
Last active November 17, 2016 18:36
IBM Power hook for Satellite 6
#!/usr/bin/env python
import os
import re
TFTP_PXELINUX_ROOT_CFG="/var/lib/tftpboot/pxelinux.cfg"
TFTP_GRUB_ROOT_CFG="/var/lib/tftpboot/boot/grub2/powerpc-ieee1275"
TFTP_GRUB_CFG_PREFIX="grub.cfg-"
GRUB2_TEMPLATE="""
set default=0
set timeout=5
"""
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 / automatic_debug.diff
Created October 28, 2016 04:57
automatic_debug.diff
diff --git a/homeassistant/components/device_tracker/automatic.py b/homeassistant/components/device_tracker/automatic.py
index 27bd9c6..2d10eb8 100644
--- a/homeassistant/components/device_tracker/automatic.py
+++ b/homeassistant/components/device_tracker/automatic.py
@@ -114,12 +114,15 @@ class AutomaticDeviceScanner(object):
response = requests.get(URL_VEHICLES, headers=self._headers)
response.raise_for_status()
+ _LOGGER.debug('reponse: %s', response)
@tchellomello
tchellomello / select-tablesizes.sql
Created October 21, 2016 16:17
PostgreSQL table sizes
SELECT table_name, pg_size_pretty(total_bytes) AS total
, pg_size_pretty(index_bytes) AS INDEX
, pg_size_pretty(toast_bytes) AS toast
, pg_size_pretty(table_bytes) AS TABLE
FROM (
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (
SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME
, c.reltuples AS row_estimate
, pg_total_relation_size(c.oid) AS total_bytes
, pg_indexes_size(c.oid) AS index_bytes
# /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
@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'
@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