Skip to content

Instantly share code, notes, and snippets.

View arcao's full-sized avatar

Martin Sloup arcao

View GitHub Profile
@arcao
arcao / dns-list.txt
Created April 2, 2018 10:10
DNS ping test
# Google DNS
8.8.8.8
8.8.4.4
# CloudFlare DNS
1.1.1.1
# Quad 9 DNS
9.9.9.9
@arcao
arcao / Arduino StringStream.md
Last active October 19, 2023 19:44
StringStream class / Library for Arduino

StringStream class / Library for Arduino

This piece of code is usable when you need Stream object which has to store/load data to/from Arduino String object.

Source (StringStream.h)

#ifndef _STRING_STREAM_H_
#define _STRING_STREAM_H_

#include <Stream.h>
@arcao
arcao / Arduino LowPower delay.md
Last active February 13, 2017 01:26
Delay like function for LowPower Arduino library

Delay like function for LowPower Arduino library

Here is delay-like function for Low-Power Arduino library. All delay measurments are performed with ATMega328pu (8MHz internal, 3.3V).

Real delays

  • powerDownDelay(60000) = 60002.256ms
  • powerDownDelay(30000) = 30001.9615ms
  • powerDownDelay(15000) = 15001.783ms
  • powerDownDelay(10000) = 10000.08ms
  • powerDownDelay(5000) = 5000.3095ms
  • powerDownDelay(2000) = 2007.191ms
@arcao
arcao / dht&rc_mqtt.ino
Last active January 28, 2017 13:50
Improved biacz version (original: https://gist.github.com/biacz/5ad2f56b3d055a3fc7ac700c7bc7a294). Switching lights are postponed to perform together.
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <DHT.h>
#include <ArduinoJson.h>
#include <RCSwitch.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
#include <Ticker.h>
// WiFi config

Keybase proof

I hereby claim:

  • I am arcao on github.
  • I am arcao (https://keybase.io/arcao) on keybase.
  • I have a public key whose fingerprint is E2F2 D1E5 C999 21F9 1FA1 859A 3B94 38F2 74FC D3D4

To claim this, I am signing this object:

@arcao
arcao / build.gradle
Last active August 23, 2017 08:38
Run JarJar task to repackage Gson library in Android Gradle build script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.0'
}
}
apply plugin: 'com.android.application'
@arcao
arcao / gist:6491762
Created September 9, 2013 05:19
Parse JSON Date created by .NET, for example: /Date(1378670400000-0500)/
protected static Date parseJsonDate(String date) {
Pattern DATE_PATTERN = Pattern.compile("/Date\\((-?\\d+)([-+]\\d{4})?\\)/");
Matcher m = DATE_PATTERN.matcher(date);
if (m.matches()) {
long time = Long.parseLong(m.group(1));
long zone = 0;
if (m.group(2) != null && m.group(2).length() > 0)
zone = Integer.parseInt(m.group(2)) / 100 * 1000 * 60 * 60;