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
-- Test if a file exists using Lua posix https://github.com/rrthomas/luaposix. | |
local posix = require('posix') | |
-- Test if a file exists. | |
-- @param fname string | |
-- filename | |
-- @return boolean | |
-- true if file exists, false otherwise | |
-- |
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
#-*- mode: nginx; mode: flyspell-prog; ispell-local-dictionary: "american" -*- | |
### fastcgi configuration for Drupal8. | |
## 1. Parameters. | |
fastcgi_param QUERY_STRING q=$uri&$args; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param REQUEST_URI $request_uri; |
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
-- Playing with the nixio.fs library. | |
local nixiofs = require('nixio.fs') | |
-- Test if a file exists. | |
-- @param fname string | |
-- filename | |
-- @return boolean | |
-- true if file exists, false otherwise | |
-- |
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
server { | |
listen 80; # IPv4 | |
listen [::]:80 ipv6only=on; # IPv6 | |
server_name ~^(?<thishost>[^.]+\.)?subdomain\.example\.com$; | |
access_log off; | |
location / { | |
## Resolve the upstream address using this DNS server or any other. | |
## Choose the one that suits you. |
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
## Here's the way to have Nginx return a robots.txt file that disallows all crawling by bots. | |
## This is useful for development and private sites. | |
location = /robots.txt { | |
return 200 "User-agent: *\nDisallow: /\n"; | |
} |
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
;; When we are in cdlatex mode then | |
;; rebind the TAB key so that pabbrev | |
;; -mode completions still work. | |
(when (and (boundp 'cdlatex-mode) | |
(boundp 'pabbrev-mode) | |
pabbrev-mode | |
cdlatex-mode) | |
(local-set-key '[f12] 'pabbrev-expand-maybe)) |
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
-- Using LuaSQL for sqlite3 DB handling. | |
require('luasql.sqlite3') | |
local env = assert(luasql.sqlite3()) -- create the context | |
local conn = assert(env:connect("test.sqlite")) -- connect to the DB | |
-- Do some queries. | |
assert(conn:execute("CREATE TABLE IF NOT EXISTS tbl1(one varchar(10), two smallint)")) | |
assert(conn:execute("INSERT INTO tbl1 VALUES('hello!', 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
Your NodeMCU custom build finished successfully. You may now download the firmware: | |
- float: http://nodemcu-build.com/builds/nodemcu-dev-10-modules-2016-06-09-18-06-12-float.bin | |
- integer: http://nodemcu-build.com/builds/nodemcu-dev-10-modules-2016-06-09-18-06-12-integer.bin | |
This was built against the dev branch and includes the following modules: cjson, dht, file, gpio, mqtt, net, node, tmr, uart, wifi. | |
The files are guaranteed to be available for download for 24h. |
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 the interface to Tessel hardware | |
var tessel = require('tessel'); | |
//Install mqtt library using: npm install mqtt | |
var mqtt = require('mqtt'); | |
var client = mqtt.connect({ | |
servers:[{'host':'mqtt.relayr.io'}], | |
// Add your credentials here. | |
username: "<my device ID>", // add your own |
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
/* | |
* Property: isOn | |
* Returns: boolean (true or false) if led is on | |
* | |
* Checks the led to see if it is on or not. | |
*/ | |
if (led.isOn) | |
{ | |
console.log('The green LED is currently on.'); | |
} |