Skip to content

Instantly share code, notes, and snippets.

@DarkFox
DarkFox / update_all_esphome_devices.yaml
Created September 6, 2023 13:37
Home Assistant script to call update.install on all ESPHome devices with available updates.
script:
update_all_esphome_devices:
alias: "Update All ESPHome Devices"
sequence:
- alias: "Call update.install on all ESPHome devices with available updates"
service: update.install
target:
entity_id: >
[{% for entity in states.update %}
{% if entity.state == 'on' and entity.attributes.title == 'ESPHome' -%}
input_select:
playlist:
name: Playlist
options:
- ''
playlist_player:
name: Playlist Player
initial: None
options:
- None
@DarkFox
DarkFox / notifications.yaml
Last active September 25, 2017 02:23
It's the little things. :)
automation:
- alias: Bathroom Window Warning
initial_state: true
trigger:
platform: state
entity_id: binary_sensor.apartment_door
to: 'on'
condition:
condition: state
entity_id: binary_sensor.bathroom_window
commandArray = {}
remoteScript = '/home/pi/domoticz/scripts/remote.sh'
for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName=='Bravia TV') then
if (deviceValue == 'On') then
commandArray['TV'] = 'Set Level: 50 %'
else
commandArray['TV'] = 'Off'
end
@DarkFox
DarkFox / find_imdb_id.rb
Created August 18, 2012 11:55
lazyness ftw
require 'nokogiri'
require 'open-uri'
require 'uri'
imdb_url = "http://www.imdb.com/find?s=tt&q="
raise 'Not a file' unless File.file?(ARGV[0])
filename = File.basename(ARGV[0])
extension = File.extname(filename)
movie = filename[/_UNKNOWN_(.+)#{extension.gsub('.','\.')}/, 1]
@DarkFox
DarkFox / syntax_highlighting.py
Created April 23, 2012 12:36 — forked from JeanMertz/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """
def on_load(self, view):
filename = view.file_name()
cart_rebate_line_id
@DarkFox
DarkFox / gist:1564985
Created January 5, 2012 12:03
Insert translation tag (Copying any selected text to clipboard)
`if [[ "${TM_SELECTED_TEXT}" != "" ]]
then printf "'${TM_SELECTED_TEXT}'" | pbcopy
fi`${TM_RAILS_TEMPLATE_START_RUBY_EXPR}t '${1:key}'${TM_RAILS_TEMPLATE_END_RUBY_EXPR}
PUBLIC_KEY
$ gem install bundler
Fetching: bundler-1.0.17.gem (100%)
dyld: lazy symbol binding failed: Symbol not found: _syckparse
Referenced from: /Users/martin/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i386-darwin11.0.0/syck.bundle
Expected in: flat namespace
dyld: Symbol not found: _syckparse
Referenced from: /Users/martin/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i386-darwin11.0.0/syck.bundle
Expected in: flat namespace