Skip to content

Instantly share code, notes, and snippets.

View dzungpv's full-sized avatar

Pham Viet Dzung dzungpv

View GitHub Profile
/* P1P2Serial: Library for reading/writing Daikin/Rotex P1P2 protocol
*
* Copyright (c) 2019-2022 Arnold Niessen, arnold.niessen-at-gmail-dot-com - licensed under CC BY-NC-ND 4.0 with exceptions (see LICENSE.md)
*
* Version history
* 20230618 v0.9.39 H-link fix buf size
* 20230604 v0.9.38 H-link branch merged into main branch
* 20230604 v0.9.37 Support for V1.2 hardware
* 20221028 v0.9.23 ADC code
* 20220918 v0.9.22 scopemode also for writes, focused on actual errors, fake error generation for test purposes, removing OLDP1P2LIB
/* P1P2Serial: Library for reading/writing Daikin/Rotex P1P2 protocol
*
* Copyright (c) 2019-2022 Arnold Niessen, arnold.niessen-at-gmail-dot-com - licensed under CC BY-NC-ND 4.0 with exceptions (see LICENSE.md)
*
* Version history
* 20230604 v0.9.38 H-link branch merged into main branch
* 20230604 v0.9.37 Support for V1.2 hardware
* 20221028 v0.9.23 ADC code
* 20220918 v0.9.22 scopemode also for writes, focused on actual errors, fake error generation for test purposes, removing OLDP1P2LIB
* 20220830 v0.9.18 version alignment with example programs (last version supporting OLDP1P2LIB)
/* P1P2Serial_ADC.h: header file for ADC support in P1P2Serial
*
* Copyright (c) 2022 Arnold Niessen, arnold.niessen-at-gmail-dot-com - licensed under CC BY-NC-ND 4.0 with exceptions (see LICENSE.md)
*
* Version history
* 20221029 v0.9.23 ADC code
*
*/
// file included by P1P2Serial (P1P2Serial.h) and by P1P2-bridge-esp8266/P1P2MQTT in different locations, so keep header files in sync
@dzungpv
dzungpv / tz_data.json
Created December 27, 2023 02:38 — forked from alwynallan/tz_data.json
Worldwide timezone data for iotclock.js
{
"servers":[
{"name":"pool.ntp.org"},
{"name":"asia.pool.ntp.org"},
{"name":"europe.pool.ntp.org"},
{"name":"north-america.pool.ntp.org"},
{"name":"oceania.pool.ntp.org"},
{"name":"south-america.pool.ntp.org"}
],
"regions":[
@dzungpv
dzungpv / cleanup_swap.md
Created March 26, 2023 14:22 — forked from anildigital/cleanup_swap.md
Cleanup swap space on macOS

To see current swap usage

sysctl -a | grep swap

Use only when when your system is in a very bad shape

$ sudo pkill -HUP -u _windowserver 
@dzungpv
dzungpv / proguard-rules.pro
Created March 8, 2021 11:30 — forked from jemshit/proguard-rules.pro
Proguard rules for common Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;
@dzungpv
dzungpv / Arduino 230v Light bulb dimming
Created April 27, 2020 12:17 — forked from ryanamaral/Arduino 230v Light bulb dimming
Arduino 230v Light Bulb Dimming (Portugal 220V 50 Hz)
//source: http://electronics.stackexchange.com/q/59615
int AC_LOAD = 3; // Output to Opto Triac pin
int dimming = 128; // Dimming level (0-128) 0 = ON, 128 = OFF
void setup()
{
pinMode(AC_LOAD, OUTPUT); // Set the AC Load as output
attachInterrupt(0, zero_crosss_int, RISING); // Choose the zero cross interrupt # from the table above
}
@dzungpv
dzungpv / DNCKATSW001
Created June 24, 2018 02:27
DNCKATSW001 Light Switch
Ligh Switch base on Samplight Z-Stack Home 1.2.2a for CC2530, 2538 SOC
1, Download Z-Stack Home 1.2.2a it is free but require to regiter http://www.ti.com/tool/Z-STACK-ARCHIVE
2, Edit file C:\Texas Instruments\Z-Stack Home 1.2.2a.44539\Projects\zstack\HomeAutomation\SampleLight\Source\zcl_samplelight_data.c with those infor:
const uint8 zclSampleLight_ManufacturerName[] = { 6, 'D','N','C','K','A','T' };
const uint8 zclSampleLight_ModelId[] = { 11, 'D','N','C','K','A','T','_','S','0','0','1' };
const uint8 zclSampleLight_DateCode[] = { 16, '2','0','1','8','0','6','2','3',' ',' ',' ',' ',' ',' ',' ',' ' };
3,Add report state code to zclSampleLight_LcdDisplayUpdate:
//report state
zclSampleLightSeqNumState++;
@dzungpv
dzungpv / build.gradle
Created July 23, 2016 14:56 — forked from ok3141/build.gradle
Gradle obfuscate string
apply from: "$rootDir/utils.gradle"
android {
defaultConfig {
buildConfigField 'String', 'SECRET_KEY', toJavaCodeString(SECRET_KEY)
}
}
@dzungpv
dzungpv / CoreMotion.m
Last active July 6, 2016 03:53 — forked from bwhitman/CoreMotion.m
Example output and query code for the historical "M7" data from CMMotionActivityManager
/*
2013-09-29 21:23:26.468 perf[3911:60b] Sep 26, 2013, 8:47 AM confidence high type walking steps 16
2013-09-29 21:23:26.469 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 0
2013-09-29 21:23:26.471 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type steps 0
2013-09-29 21:23:26.472 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type walking steps 0
2013-09-29 21:23:26.474 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence medium type walking steps 0
2013-09-29 21:23:26.475 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 341
2013-09-29 21:23:26.476 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence high type walking steps 6
2013-09-29 21:23:26.478 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence low type steps 18
2013-09-29 21:23:26.480 perf[3911:60b] Sep 26, 2013, 9:05 AM confidence low type steps 6