Skip to content

Instantly share code, notes, and snippets.

View tchellomello's full-sized avatar

Marcelo Mello tchellomello

View GitHub Profile
@tchellomello
tchellomello / ring.py
Created November 7, 2017 05:01
camera ring.py
"""
This component provides support to the Ring Door Bell camera.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.ring/
"""
import asyncio
import logging
from datetime import datetime, timedelta
@tchellomello
tchellomello / ring.py
Last active March 11, 2020 21:11
Prototype Ring Door Bell Camera (make sure this file is located in the custom_components/camera directory)
"""
This component provides support to the Ring Door Bell camera.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.ring/
"""
import asyncio
from datetime import datetime, timedelta
import pytz
import dateutil.parser
@tchellomello
tchellomello / katello_queue.sh
Created April 28, 2017 20:18
foreman/katelloqueue
CERT=/etc/pki/katello/certs/katello-apache.crt
KEY=/etc/pki/katello/private/katello-apache.key
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b "amqps://localhost:5671" add exchange topic event --durable
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b "amqps://localhost:5671" add queue katello_event_queue --durable
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b "amqps://localhost:5671" bind event katello_event_queue '*.*'
@tchellomello
tchellomello / postgres-cheatsheet.md
Created February 21, 2017 21:13 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@tchellomello
tchellomello / ring.py
Created February 17, 2017 04:39
Beta Ring sensor for HA
"""
This component provides HA sensor support for Ring Door Bell/Chimes.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.ring/
"""
import logging
from datetime import timedelta
import voluptuous as vol
@tchellomello
tchellomello / zwave-events.py
Last active March 25, 2017 11:36
Script to monitor Open Zwave events for ZRC90 scene control
#!/usr/bin/env python3
import socket
import requests
from subprocess import Popen, PIPE
import json
## line which as Node004 ZRC-90 command
# scene1
#2017-01-14 23:36:31.244 Detail, Node004, Received: 0x01, 0x0b, 0x00, 0x04, 0x00, 0x04, 0x05, 0x5b, 0x03, 0x66, 0x00, 0x01, 0xce
# scene2
@tchellomello
tchellomello / 12-ppc64-wrapper.py
Created February 1, 2017 22:39
Foreman Hook for PPC64 provisioning
#!/usr/bin/env python
# vim:ts=4:sw=4:et
import os
import socket
import sys
import requests
import tempfile
sys.path.append('/usr/share/foreman/config')
@tchellomello
tchellomello / pulp-admin.sh
Last active January 28, 2019 19:24
pulp-admin.sh
#!/bin/bash
STATE=""
for TASK in `pulp-admin tasks list | egrep '^Task Id:|^State:' | sed -e 's,^Task Id: ,,' -e 's,^State: ,,'`; do
if [ "$STATE" = "" ]; then
STATE=$TASK
else
if [ $STATE != Successful ] && [ $STATE != Cancelled ] && [ $STATE != Failed ]; then
pulp-admin tasks details --task-id=$TASK
pulp-admin tasks cancel --task-id=$TASK
fi
@tchellomello
tchellomello / amcrest.py
Last active January 11, 2017 22:16
HA Amcrest Sensor - Beta
"""
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/sensor.amcrest/
"""
from datetime import timedelta
import logging
import voluptuous as vol
@tchellomello
tchellomello / active_queries_sat5.sh
Created November 30, 2016 22:21
Monitor active queries for Satellite 5
#!/bin/bash
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'.')
if [ $PG_VERSION -eq 9 ]; then
echo "SELECT query,xact_start,query_start FROM pg_stat_activity GROUP BY query,xact_start,query_start;" | spacewalk-sql --select-mode -
elif [ $PG_VERSION -eq 8 ]; then