Skip to content

Instantly share code, notes, and snippets.

View sleiner's full-sized avatar

Simon Leiner sleiner

  • Karlsruhe, Germany
View GitHub Profile
@sleiner
sleiner / create_group.yaml
Last active March 29, 2024 15:13 — forked from mwolter805/create_group.yaml
Home Assistant Blueprint: Create a group with either dynamic or with static members.
blueprint:
name: Create Group
description: |
# Create Group Blueprint
This blueprint creates a group with either static or dynamic members.
It has two main functions to add members
- Dynamically include multiple members based on a common string in their object ID's. (```Dynamic Include List```)
- Or statically add individual members. (```Static Entities To Add```)
@sleiner
sleiner / std-test.c
Last active July 31, 2020 07:52
Testing for GCC compile-time constants quickly
/* Tests compile constants in GCC */
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#if defined(__STDC_VERSION__)
#pragma message STR(__STDC_VERSION__)
#else
#pragma message "__STDC_VERSION__ not defined"
#endif
@sleiner
sleiner / wunderground_countrycode_mapping.py
Last active January 9, 2017 20:42
Unfortunately wunderground.com, does not use ISO country codes. Here is a python dict to look up the wunderground country code from the ISO code. See https://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching
# matching from https://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching
#
# example:
# >>>> langcode = iso_to_wu['DE'] # Germany
# 'DL'
iso_to_wu = {
'AF': 'AH',
'AL': 'AB',
'DZ': 'AL',
#include <conio.h>
char arrowkey_input() {
char input_ch = _getch();
// detect arrow keys (idea from http://stackoverflow.com/questions/10463201/getch-and-arrow-codes/11432632#11432632)
if (input_ch == -32) { // prefix for arrow keys
switch (_getch()) { // the real value
case 72: // up
return 'u';