Skip to content

Instantly share code, notes, and snippets.

In the directory your configuration.yaml file is location, create a folder called custom_components and put group_globber.py there. Then inside your configuration.yaml file, add a section like so:
group_globber:
groups:
group.group_emby:
- media_player.emby*
You should probably already have the group, in this case "group_emby" already created somewhere. Then you can add a list of wildcards that'll match entities and put them in that group.
Note: I have not tried modifying the built in "all" groups and I have always had the group I want to add things to already created.
@xentac
xentac / README
Last active October 1, 2018 18:57
Authentication with aggressive web worker caching
When mixing cookie-based out-of-application authentication and a websocket
application that attempts to hijack all attempts at authentication, one needs to
pick ones battles. Sometimes allowing unauthenticated access is the only way to
do certain things.
Take, for example,
https://github.com/home-assistant/home-assistant-polymer/issues/110 and
https://github.com/home-assistant/home-assistant/issues/6184. The entire site is
driven by a webworker that caches all urls
(https://github.com/home-assistant/home-assistant-polymer/blob/3701683d4b4ab2bd0ceb4ab78
@janstuemmel
janstuemmel / README.md
Last active May 26, 2020 13:47
Installation script for a portable platformio editor

a simple install script to build a portable version of the [PlatformIO IDE][pioide] based on the atom editor.

referenced to [platformio/platformio-atom-ide/issues/158][ref]

Usage

  • wget https://gist.githubusercontent.com/janstuemmel/5dea680981d443c8d93c9c7e12f08611/raw/install.sh
  • chmod +x install.sh
  • execute: ./install.sh v1.14.4
@loleg
loleg / iotcam.py
Created November 7, 2015 01:26
Detects barcodes from a webcam stream using Python, zbar and CV2
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import sys
import cv2
import zbar
import Image
# Debug mode
DEBUG = False
@bigbosst
bigbosst / supervisorctl
Last active November 29, 2018 12:03 — forked from pfreixes/gist:3187511
supervisorctl bash completion
# pfreixes, 2012-07-27
# Add to /etc/bash_completion.d/supervisorctl
_supervisor()
{
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@atupal
atupal / select_input.py
Created June 26, 2013 06:36
Keyboard input with timeout in Python
import sys, select
print "You have ten seconds to answer!"
i, o, e = select.select( [sys.stdin], [], [], 10 )
if (i):
print "You said", sys.stdin.readline().strip()
else:
print "You said nothing!"
@trongthanh
trongthanh / gist:2779392
Last active October 30, 2025 21:44
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@sebzur
sebzur / polish_holidays.py
Created February 12, 2012 20:25
Python generator for public holidays in Poland
from datetime import date, timedelta
from dateutil import easter
from dateutil.relativedelta import *
def get_holidays(year=2010):
""" Returns Polish hollidays dates (legally considered non-working days) """
easter_sunday = easter.easter(year)
holidays = {'New Year': date(year,1,1),
'Trzech Kroli': date(year,1,6),
'Easter Sunday': easter_sunday,
@dln
dln / uuid_bench.md
Created May 26, 2010 08:23
Quick benchmark of time-based UUID generation in python, clojure/java and C.

TimeUUIDs in Python are slow. Clojure (Java) is fast.

Python

85 >>> def test():
    for _ in xrange(1000000):
        uuid.uuid1()

...: