This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://stackoverflow.com/questions/38990950/simulating-esp8266-server-multithreading | |
someint = 5 | |
a = 1 | |
srv:listen(8080,function(conn) | |
conn:on("receive", function(client,request) | |
client:send(someint); | |
client:close(); -- btw, you should wait for 'sent' event before closing, see http://nodemcu.readthedocs.io/en/latest/en/modules/net/#example_6 | |
end) | |
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ********************************************************************************************************************* | |
// I needed to redefine the remap() function invoked at | |
// https://github.com/APIDevTools/json-schema-ref-parser/blob/master/lib/bundle.js#L25 due to | |
// https://github.com/APIDevTools/swagger-parser/issues/127 | |
// | |
// I'm not versed enough with JavaScript and Node.js to understand if there would be a less invasive way to have my own | |
// remap(). As far as I understand SwaggerParser (or JSON Schema $Ref Parser for that matter) is not built in a way that | |
// allows to easily extend it. The only option I found was to redefine the bundle() prototype function and to copy a lot | |
// of code from bundle.js. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// inspired by a note at http://php.net/manual/en/function.getmxrr.php | |
// further inspiration from https://github.com/webdigi/SMTP-Based-Email-Validation | |
function validateEmail($email) | |
{ | |
$emailValid = false; | |
$domain = extractFullyQualifiedDomainFromEmail($email); | |
$mxHost = findPreferredMxHostForDomain($domain); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: https://github.com/markszabo/IRremoteESP8266/blob/master/src/IRutils.cpp#L48 | |
String uint64ToString(uint64_t input) { | |
String result = ""; | |
uint8_t base = 10; | |
do { | |
char c = input % base; | |
input /= base; | |
if (c < 10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh <user>@<mac-without-screen> | |
$ sudo defaults write /var/db/launchd.db/com.apple.launchd/overrides.plist com.apple.screensharing -dict Disabled -bool false | |
$ sudo launchctl load /System/Library/LaunchDaemons/com.apple.screensharing.plist | |
/System/Library/LaunchDaemons/com.apple.screensharing.plist: Service is disabled | |
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import okhttp3.Credentials | |
import okhttp3.OkHttpClient | |
import okhttp3.Request | |
import okhttp3.Response | |
import org.json.JSONObject | |
import java.time.Duration | |
import java.time.Instant | |
import java.util.logging.Logger | |
// Inspired by https://www.pimwiddershoven.nl/entry/request-an-api-bearer-token-from-gitlab-jwt-authentication-to-control-your-private-docker-registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************************************************/ | |
/* */ | |
/* Adaptation and simplification of the blue-print sketch at */ | |
/* https://github.com/khoih-prog/ESPAsync_WiFiManager/tree/master/examples/Async_ConfigOnSwitch */ | |
/* */ | |
/**************************************************************************************************/ | |
#include <esp_wifi.h> | |
#include <WiFi.h> | |
#include <WiFiClient.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.base.Preconditions; | |
import lombok.extern.slf4j.Slf4j; | |
import net.shibboleth.utilities.java.support.xml.ParserPool; | |
import net.shibboleth.utilities.java.support.xml.XMLParserException; | |
import org.apache.commons.lang3.StringUtils; | |
import org.opensaml.core.config.InitializationException; | |
import org.opensaml.core.config.InitializationService; | |
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport; | |
import org.opensaml.core.xml.io.Unmarshaller; | |
import org.opensaml.core.xml.io.UnmarshallerFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import thingspeak # from https://thingspeak.readthedocs.io/en/latest/ | |
import bme280 # from https://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/ | |
# return the Pi CPU/GPU temperature in degree Celcius; it's a SoC and thus there's no need to read both, see | |
# https://www.cyberciti.biz/faq/linux-find-out-raspberry-pi-gpu-and-arm-cpu-temperature-command/#comment-796904 | |
def get_temp(): | |
with open('/sys/class/thermal/thermal_zone0/temp', 'r') as infile: | |
return float(infile.read()) * 1e-3 | |
ch = thingspeak.Channel(275145, "*********", "*********") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- inspired by https://github.com/hackhitchin/esp8266-co-uk/blob/master/tutorials/introduction-to-gpio-api.md | |
-- and http://www.esp8266.com/viewtopic.php?f=24&t=4833&start=5#p29127 | |
local pin = 4 --> GPIO2 | |
function debounce (func) | |
local last = 0 | |
local delay = 50000 -- 50ms * 1000 as tmr.now() has μs resolution | |
return function (...) | |
local now = tmr.now() |
NewerOlder