Skip to content

Instantly share code, notes, and snippets.

View adamawolf's full-sized avatar

Adam Wolf adamawolf

View GitHub Profile
blueprint:
name: zigbee2mqtt Aqara 6-button Opple Switch control
description: ''
domain: automation
input:
button_mqtt_action:
name: MQTT action topic for Switch
description: Switch\'s MQTT topic (e.g. zigbee2mqtt/Switch Name Here/action)
selector:
text:
blueprint:
name: zigbee2mqtt Hue Dimmer Switch control v4
description: ''
domain: automation
input:
dimmer_action:
name: Dimmer MQTT topic
description: 'Dimmer MQTT topic (i.e. zigbee2mqtt/Your Dimmer Switch/action)'
selector:
text:
@adamawolf
adamawolf / delete_all_kindle_documents.js
Created January 25, 2013 19:00
Faced with 80 old Instapaper Kindle documents and no delete all button, I did what any self respecting coder would do.
//load jquery in console separately first
var jq = document.createElement('script');
jq.src = "http://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();
//delete ALL entries currently listed in Manage Your Kindle screen
idsToDelete = []
$('form[name="fionaDL"] input[name="contentName"]').each(function () { idsToDelete.push(this.value); })
$(idsToDelete).each(function() {Fion.deleteItem('deleteItem_' + this);})
@adamawolf
adamawolf / gist:3823502
Created October 2, 2012 21:44
How to print out a CGPathRef for debugging purposes
static void outputApplier(void* info, const CGPathElement* element)
{
NSMutableArray* a = (NSMutableArray*) info;
int nPoints;
NSString * pathElementType = nil;
switch (element->type)
{
case kCGPathElementMoveToPoint:
@adamawolf
adamawolf / geojson_us.js
Created September 3, 2012 23:15
GeoJSON Multipolygon for the United States
{
"type": "MultiPolygon",
"coordinates":
[
[
[
[ -123.123779, 48.227039 ], // contig. u.s.
[ -123.318787, 49.000042 ],
[ -121.742592, 49.000267 ],
[ -95.157394, 49.000493 ],
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active October 5, 2024 01:46
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@adamawolf
adamawolf / gist:2698506
Created May 15, 2012 01:58
Prevent UIWebView callouts when users long tap on links
[[self webView] stringByEvaluatingJavaScriptFromString:@"\
var css = document.createElement(\"style\");\
css.type = \"text/css\";\
css.innerHTML = \"body { -webkit-touch-callout: none; }\";\
document.body.appendChild(css);"];
@adamawolf
adamawolf / Remap.c
Created May 29, 2010 01:52
An Objective-C data structure that accepts setVariableName: and variableName messages without declaring a variableName property.
//
// Remap.m
//
// Created by Adam Wolf on 5/24/10.
//
#import "Remap.h"
@interface Remap ()
@property (nonatomic, retain) NSMutableDictionary * _data;