Skip to content

Instantly share code, notes, and snippets.

@gadgetchnnel
gadgetchnnel / light.py
Created Dec 21, 2019
Replacement light.py for HA Tuya component (with brightness level mapping)
View light.py
"""Support for the Tuya lights."""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ENTITY_ID_FORMAT,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
@douglascayers
douglascayers / ApexCsvExample.java
Created Jan 2, 2017
Apex CSV Example. Note the use of String.escapeCsv() method
View ApexCsvExample.java
String csv = 'Id,Name\n';
for ( List<Account> accts : [ SELECT id, name FROM Account LIMIT 10 ] ) {
for ( Account acct : accts ) {
csv += acct.id + ',' + acct.name.escapeCsv() + '\n';
}
}
ContentVersion file = new ContentVersion(
title = 'accounts.csv',
versionData = Blob.valueOf( csv ),
@G33kDude
G33kDude / GDI.ahk
Last active Aug 11, 2019
GDI wrapper for AutoHotkey
View GDI.ahk
class GDI
{
__New(hWnd, CliWidth=0, CliHeight=0)
{
if !(CliWidth && CliHeight)
{
VarSetCapacity(Rect, 16, 0)
DllCall("GetClientRect", "Ptr", hWnd, "Ptr", &Rect)
CliWidth := NumGet(Rect, 8, "Int")
CliHeight := NumGet(Rect, 12, "Int")
@dlech
dlech / htway.py
Last active Jan 24, 2021
ev3dev HTWay
View htway.py
#!/usr/bin/env python
# Python port of the HiTechnic HTWay for ev3dev
# Copyright (c) 2014-2015 G33kDude, David Lechner
# HiTechnic HTWay is Copyright (c) 2010 HiTechnic
import itertools
import os
import struct
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active Jun 7, 2021
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
View Git push deployment in 7 easy steps.md