Skip to content

Instantly share code, notes, and snippets.

@honcheng
honcheng / app_zoned_clean bedroom.json
Created April 28, 2018 02:52
app_zoned_clean for bedroom
{
"entity_id": "vacuum.xiaomi_vacuum_cleaner",
"command": "app_zoned_clean",
"params": [[29500,21000,33200,25000,1]]
}
@honcheng
honcheng / app_zoned_clean living room excluding rug.json
Last active April 28, 2018 02:50
app_zoned_clean params for living room excluding area with rug
{
"entity_id": "vacuum.xiaomi_vacuum_cleaner",
"command": "app_zoned_clean",
"params": [
[28500, 25500, 30200, 29000, 1],
[29500, 27800, 34000, 29000, 1],
[32500, 25500, 34000, 29000, 1],
[30000, 25500, 32500, 25800, 1]
]
}
@honcheng
honcheng / sensor.yaml
Last active January 11, 2018 04:54
Home Assistant custom 2-states rain sensor with Weather Underground
- platform: template
sensors:
rain_sensor:
friendly_name: "Rain Sensor"
value_template: >-
{% if is_state('sensor.pws_weather', 'Light Thunderstorms and Rain') %}
rain
{% elif is_state('sensor.pws_weather', 'Heavy Thunderstorms and Rain') %}
rain
{% elif is_state('sensor.pws_weather', 'Thunderstorms and Rain') %}
@honcheng
honcheng / config.json
Created April 11, 2017 14:57
Sample config.json file for pilight
{
"devices": {},
"rules": {},
"gui": {},
"settings": {
"log-level": 6,
"pid-file": "/var/run/pilight.pid",
"log-file": "/var/log/pilight.log",
"webserver-enable": 1,
"webserver-root": "/usr/local/share/pilight/",
@honcheng
honcheng / config.json
Created April 11, 2017 02:05
Sample config.json for HomeBridge showing addition of RF-Remote Fan
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"platforms": [{
"platform": "Orvibo"
}],
@honcheng
honcheng / mailchimpToTestFlightCSV.py
Created April 6, 2017 04:07
Import MailChimp csv file to TestFlight-compatible csv
import sys
def main():
mailchimp_infile = open(sys.argv[1],"r")
testflight_outfile = open(sys.argv[2],"w")
mailchimp_lines = mailchimp_infile.readlines()
new_data = ""
for index in range(1, len(mailchimp_lines)):
line = mailchimp_lines[index]
@honcheng
honcheng / NextRideLaunch
Created November 22, 2012 07:37
Launching NextRide app for routing using URL scheme
- (void)routeNextRideFromStartLocation:(CLLocation*)startLocation toEndLocation:(CLLocation*)endLocation
{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"nextride://"]]){
NSMutableString *requestPath = [NSMutableString stringWithString:@"nextride://nextride.sg/route?route_mode=both"];
if (startLocation){
[requestPath appendFormat:@"&route_start=%f,%f", startLocation.coordinate.latitude, startLocation.coordinate.longitude];
}
....
[self.sliderPageControl setDelegate:self];
[self.sliderPageControl setShowsHint:YES];
....
}
- (NSString *)sliderPageController:(id)controller hintTitleForPage:(NSInteger)page
{
NSString *hintTitle = [[self.demoContent objectAtIndex:page] objectForKey:@"title"];
return hintTitle;
- (id)init
{
...
[self.sliderPageControl addTarget:self action:@selector(onPageChanged:) forControlEvents:UIControlEventValueChanged];
...
}
- (void)onPageChanged:(id)sender
{
pageControlUsed = YES;
{
"url": "http:\/\/www.singpost.com.sg\/ra\/ra_article_detail_status_results.asp?ranumber=RRxxxxxxxxxSG&postingdate=11\/29\/2010&RTSOversea=False",
"origin": "KATONG DELIVERY BASE",
"status_date": "29-11-2010",
"dest_or_transit": "KATONG POST OFFICE",
"status": "DELIVERY ATTEMPTED, NOTIFICATION CARD ISSUED"
}