This file contains hidden or 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
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev libjemalloc-dev libatomic-ops-dev | |
sudo apt-get install zlib1g-dev libxslt-dev libgd-dev libgeoip-dev | |
# build lua | |
git clone https://github.com/openresty/luajit2 | |
make && make install | |
export LUAJIT_LIB=/usr/lib64; | |
export LUAJIT_INC=/usr/include/luajit-2.1; |
This file contains hidden or 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
#!/bin/sh | |
# Script to build nginx with lua support. | |
NGINX_VERSION='1.18.0' | |
NGX_DEVEL_KIT_VERSION='0.3.1' | |
LUA_NGINX_MODULE_VERSION='0.10.16rc5' | |
STREAM_LUA_NGINX_MODULE_VERSION='0.0.8rc3' | |
# we use openresty's version of luajit here. |
This file contains hidden or 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
#!/bin/sh | |
# Script to build nginx with lua support. | |
# XXX: The result might work, but it was not thoroughly tested. Use it at your | |
# own risk. If you really need nginx with LUA in production, you should use | |
# OpenResty instead. | |
NGINX_VERSION='1.20.2' | |
NGX_DEVEL_KIT_VERSION='0.3.1' |
This file contains hidden or 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
#include <ESP8266WiFi.h> | |
#define WIFI_SSID "MY SSID" | |
#define WIFI_PASSWORD "MY PASS" | |
bool isConnected() { | |
return (WiFi.status() == WL_CONNECTED); | |
} | |
void connectToWiFi(int max_tries = 20, int pause = 500) { |
This file contains hidden or 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
int ret, len; | |
mbedtls_net_context listen_fd, client_fd; | |
unsigned char buf[1024]; | |
const char *pers = "ssl_server"; | |
int port = 443 | |
mbedtls_entropy_context entropy; | |
mbedtls_ctr_drbg_context ctr_drbg; | |
mbedtls_ssl_context ssl; |
This file contains hidden or 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
curl -i -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET https://dynamicdns.park-your-domain.com/update?host=@&domain=[domain]&password=[update-password]&ip=[local-ip] |
This file contains hidden or 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
cd $HOME | |
FileName='go1.13.4.linux-armv6l.tar.gz' | |
wget https://dl.google.com/go/$FileName | |
sudo tar -C /usr/local -xvf $FileName | |
cat >> ~/.bashrc << 'EOF' | |
export GOPATH=$HOME/go | |
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin | |
EOF | |
source ~/.bashrc |
This file contains hidden or 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
//// Usage | |
var queue = createMessageQueue({ messagesPerMinute: 60 }) | |
queue.on('message', function(msg) { | |
console.log('message: ' + JSON.stringify(msg, null, 2)) | |
}) | |
queue.enqueue({ to: 'avian', from: 'sjs', body: 'cool story bro' }) |
This file contains hidden or 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
#if defined(ESP8266) | |
#define LM_PIN A0 | |
#elif defined(ESP32) | |
#define LM_PIN 36 | |
#endif | |
#define ADC_VREF_mV 5000.0 // 5000 is the voltage provided by MCU. If you connect to 3V change to 3000 | |
#define ADC_RESOLUTION 4096.0 | |
void setup() { |
This file contains hidden or 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
#ifdef ENABLE_DEBUG | |
#define DEBUG_ESP_PORT Serial | |
#define NODEBUG_WEBSOCKETS | |
#define NDEBUG | |
#endif | |
#include <Arduino.h> | |
#if defined(ESP8266) | |
#include <ESP8266WiFi.h> | |
#elif defined(ESP32) |