View toggle_device_after_time.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Toggle device status after a period of time | |
description: "Once a device has been in a defined status for a period of time, toggle it's status" | |
domain: automation | |
input: | |
trigger_device: | |
name: Device | |
description: Which device to monitor and toggle? | |
selector: | |
entity: |
View NSObject.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Either in lldb: | |
(lldb) po [self _methodDescription] | |
//or in code: | |
@interface NSObject (Private) | |
- (NSString*)_methodDescription; | |
@end | |
// Somewhere in the code: |
View HA-water-leak.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Detect water and notify | |
description: detect 'moisture' device-class and if so execute an action. | |
domain: automation | |
input: | |
actions: | |
name: Actions | |
description: Notifications or similar to be run. {{sensors}} is replaced with the names of sensors. | |
selector: | |
action: {} |
View home_assistant_cam_ptz.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# paste as a custom (manual) card in lovelace and replace all entities id | |
type: picture-glance | |
entities: | |
- entity: camera.cam_studio_profile_1 | |
tap_action: | |
action: call-service | |
service: onvif.ptz | |
service_data: | |
entity_id: camera.cam_studio_profile_1 | |
pan: LEFT |
View Tree - Breadth_first_search.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Breadth first search | |
# Definition for a binary tree node. | |
# class TreeNode: | |
# def __init__(self, val=0, left=None, right=None): | |
# self.val = val | |
# self.left = left | |
# self.right = right | |
class Solution: | |
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: | |
from collections import deque |
View Depth_first_search.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def recursive_dfs(graph, source,path = []): | |
if source not in path: | |
path.append(source) | |
if source not in graph: | |
# leaf node, backtrack | |
return path | |
for neighbour in graph[source]: | |
path = recursive_dfs(graph, neighbour, path) | |
return path |
View AVPlayer_ViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
class ViewController { | |
private var videoPlayer: AVPlayer? | |
private var playerItem: AVPlayerItem? | |
private var layer: AVPlayerLayer? | |
func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) |
View gist:e16cebdd4c8b072281c559a9f992063b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in *.heic; do sips -s format jpeg -s formatOptions best "${i}" --out "${i%heic}jpg" && touch -r "${i}" "${i%heic}jpg"; done |
View python_equalisty_hash.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#source: https://stackoverflow.com/questions/390250/elegant-ways-to-support-equivalence-equality-in-python-classes | |
class Number: | |
def __init__(self, number): | |
self.number = number | |
def __eq__(self, other): | |
"""Overrides the default implementation""" | |
if isinstance(other, Number): |
NewerOlder