Skip to content

Instantly share code, notes, and snippets.

View tchellomello's full-sized avatar

Marcelo Mello tchellomello

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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
### Keybase proof
I hereby claim:
* I am tchellomello on github.
* I am tchellomello (https://keybase.io/tchellomello) on keybase.
* I have a public key ASBbVk33aSGv5wr20jQjY8tvd4rWLTKAw5_nU_EhtAuxjQo
To claim this, I am signing this object:
@tchellomello
tchellomello / pgsql_queries.sql
Created February 26, 2018 19:17
PostgreSQL queries
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'

Keybase proof

I hereby claim:

  • I am tchellomello on github.
  • I am tchellomello (https://keybase.io/tchellomello) on keybase.
  • I have a public key whose fingerprint is 80EB 7351 E74D 2928 80F2 5B9E A252 99D7 632F DE44

To claim this, I am signing this object: