This file contains hidden or 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
| console.clear(); | |
| function getFields(fields, parent){ | |
| var rows = [" fields = ("]; | |
| $(fields, parent).each(function(){ | |
| var regex = /field-([^ ]+)/g; | |
| var columns = []; | |
| while(match = regex.exec(this.className)){ | |
| columns.push(match[1]); | |
| } |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| # | |
| # This file is a plugin for EventGhost. | |
| # Copyright (C) 2012 Walter Kraembring <krambriw>. | |
| # | |
| # ALL RIGHTS RESERVED. The development of this software is based on information | |
| # provided by RFXCOM and is protected under Netherlands Copyright Laws and | |
| # Treaties and shall be subject to the exclusive jurisdiction of the Netherlands | |
| # Courts. | |
| # This pluginís source code and other versions eventually based on it may be |
This file contains hidden or 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
| :global wanInterface "wan1" | |
| :global wanIP "$wanIP" | |
| # Get the current IP on the interface | |
| :local currentIPtemp [/ip address get [find interface="$wanInterface" disabled=no] address]; | |
| # IP without netmask | |
| :local currentIP [:pick $currentIPtemp 0 ([:len $currentIPtemp]-3)]; | |
| :if ($currentIP != $wanIP) do={ |
This file contains hidden or 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 sys | |
| import webbrowser | |
| def main(): | |
| return 42/0 | |
| def excepthook(type_, value, traceback): | |
| webbrowser.open_new_tab('https://stackoverflow.com/search?q=[python] {} {}'.format(type_, value)) |
This file contains hidden or 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
| /* vim: ts=8 | |
| Example code for the SJ1221 control protocol | |
| Based on: http://wp.josh.com/2014/05/11/ws2812-neopixels-made-easy/ | |
| */ | |
| // Change this to be at least as long as your pixel string (too long will work fine, just be a little slower) | |
| #define PIXELS 96*11 // Number of pixels in the string | |
| // color multiplier since we've got 0-4096 instead of 0-256 |
This file contains hidden or 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
| #!/usr/bin/env python | |
| from __future__ import print_function | |
| import os | |
| import shutil | |
| import subprocess | |
| def get_width(default=80): | |
| '''Attempt to detect console width and default to 80''' |
This file contains hidden or 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 read(fh, timeout=0): | |
| output = [] | |
| while select.select([fh], [], [], timeout)[0]: | |
| output.append(fh.read(1)) | |
| return ''.join(output) |
This file contains hidden or 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
| # - alias: close curtains | |
| # trigger: | |
| # - event: sunset | |
| # platform: sun | |
| # condition: [] | |
| # action: | |
| # - data: | |
| # entity_id: cover.qubino_zmnhod1_flush_shutter_dc_level | |
| # service: automation.turn_off |
This file contains hidden or 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
| #include <Arduino.h> | |
| // Uses https://github.com/PaulStoffregen/TimerOne for sending on a regular interval | |
| #include <TimerOne.h> | |
| // ECHO pin, needs to be a pin that supports interrupts! | |
| #define ULTRASONIC_PIN_INPUT 2 | |
| // TRIG pin, can be any output pin | |
| #define ULTRASONIC_PIN_OUTPUT 3 | |
| // update interval, make sure to keep it above 20ms | |
| #define ULTRASONIC_TIMER_US 50000 |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import enum | |
| import types | |
| import aioudp | |
| import struct | |
| import asyncio | |
| import blessings | |
| from datetime import datetime |