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
MAX7219_REG_NOOP = 0x00 | |
MAX7219_REG_DECODEMODE = 0x09 | |
MAX7219_REG_INTENSITY = 0x0A | |
MAX7219_REG_SCANLIMIT = 0x0B | |
MAX7219_REG_SHUTDOWN = 0x0C | |
MAX7219_REG_DISPLAYTEST = 0x0F | |
happy = {0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C} | |
frown = {0x3C, 0x42, 0xA5, 0x81, 0xBD, 0x81, 0x42, 0x3C} | |
sad = {0x3C, 0x42, 0xA5, 0x81, 0x99, 0xA5, 0x42, 0x3C} |
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() |
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: http://www.esp8266-projects.com/2015/03/buttons-pushbuttons-and-debouncing-story.html | |
local GPIO14 = 5 | |
local debounceDelay = <however-many-ms-your-sensor-requires> | |
local debounceAlarmId = <0-6> | |
gpio.mode(GPIO14, gpio.INT, gpio.PULLUP) | |
gpio.trig(GPIO14, "down", doorLocked) | |
function doorLocked() | |
-- don't react to any interupts from now on and wait 50ms until the interrupt for the up event is enabled | |
-- within that 50ms the switch may bounce to its heart's content |
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
-- If you have a recent firmware from the dev branch you could do away with that ugly timer | |
-- by relying on WiFi events and (re-)acting accordingly. See wifi.sta.eventMonReg() at | |
-- https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en#wifistaeventmonreg | |
-- init all globals | |
... | |
wifiReady = 0 | |
function configureWiFi() |
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
... | |
<!-- http://docs.spring.io/spring-security/site/docs/4.0.x/reference/htmlsingle/#filter-stack --> | |
<!-- logout w/o CSRF protection if logout filter is placed before the CSRF filter --> | |
<security:custom-filter before="CSRF_FILTER" ref="logoutFilter" /> | |
</security:http> | |
<bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter"> | |
<constructor-arg name="logoutSuccessUrl" value="place-whatever-you-need-here" /> | |
<constructor-arg name="handlers"> | |
<list> |
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
------------------------------------------------------------------------------ | |
-- Net send queueing helper | |
-- | |
-- Created by devsaurus for https://github.com/nodemcu/nodemcu-firmware/pull/1207 | |
-- | |
-- See also | |
-- https://nodemcu.readthedocs.io/en/dev/en/modules/net/#netsocketsend | |
-- | |
-- Based on Vladimir Dronnikov's | |
-- MQTT queuing publish helper |
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
local numberToTable = function(number, base, minLen) | |
local t = {} | |
repeat | |
local remainder = number % base | |
table.insert(t, 1, remainder) | |
number = (number - remainder) / base | |
until number == 0 | |
if #t < minLen then | |
-- "pad" table with 0s | |
for i = 1, minLen - #t do table.insert(t, 1, 0) 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
local numberToTable = function(number, base, minLen) | |
local t = {} | |
repeat | |
local remainder = number % base | |
table.insert(t, 1, remainder) | |
number = (number - remainder) / base | |
until number == 0 | |
if #t < minLen then | |
-- "pad" table with 0s | |
for i = 1, minLen - #t do table.insert(t, 1, 0) end |
OlderNewer