Skip to content

Instantly share code, notes, and snippets.

@TerryE
TerryE / op_counts.php
Last active December 22, 2015 14:29
Simple RDTSC-based instrumentation of PHP 5.5.3
<?php
/*
* Simple parser of op_counts file. Output is desgined to be pasted / imported into spreadsheet
* for further analysis.
*/
define('PHP_SOURCE_DIR', '~/work/php55'); /* replace as required */
define('OP_COUNT', 164*25); /* as at PHP 5.5 */
define('OP_COUNT_EXTRAS', 5);
$total_count = array_fill(0, OP_COUNT + OP_COUNT_EXTRAS, 0);
$total_cycles = array_fill(0, OP_COUNT + OP_COUNT_EXTRAS, 0);
@TerryE
TerryE / Terry_005.phpt
Last active December 31, 2015 21:48
OPcache Tests
--TEST--
Validate corrrect optimisation of defined, constant, function_exists, is_callable, extension_loaded
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.file_update_protection=0
--SKIPIF--
<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
--FILE--
@TerryE
TerryE / Terry_007.phpt
Created December 23, 2013 00:24
Optimization binding of class constants is not safely opcacheable
--TEST--
Optimization binding of class constants is not safely opcacheable
--INI--
opcache.enable=0
--SKIPIF--
<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
--FILE--
<?php
$root = str_replace('.php', "", __FILE__);
$base = basename( $root );
@TerryE
TerryE / APIchanges.lst
Created November 7, 2015 15:08
List of Esp8266 SDK API changes 0.95 -> 1.4
(1.1) at_register_response_func:register a callback for user-define AT response.
(1.0) at_register_uart_rx_intr:set UART0 to be used by user or AT commands
(1.1) at_response:set AT response
(1.0) espconn_clear_opt: clear configuration of TCP connection
(1.1) espconn_dns_setserver : set default DNS server
(1.0) espconn_get_keepalive: get configuration of TCP keep-alive
(1.0) espconn_mdns_close: close mDNS 
(1.0) espconn_mdns_disable: disable mDNS 
(1.0) espconn_mdns_enable: endisable mDNS 
(1.0) espconn_mdns_get_hostname: set mDNS host name 
@TerryE
TerryE / DevVsMaster.lst
Last active May 2, 2019 01:38
NodeMCU Comparison of Dev And Master as at 10 Nov 2015
v Same
v Changed
v Only in Dev
v Only in Master
File
Y - - - app/.gitignore
- - Y - app/cjson/cjson_mem.c
- - Y - app/cjson/cjson_mem.h
Y - - - app/cjson/CMakeLists.txt
Y - - - app/cjson/devel/json_parser_outline.txt
@TerryE
TerryE / generate_user_modules.lua
Last active February 17, 2016 16:47
generate_user_modules.lua
#! /usr/bin/lua
--[[
This Lua script will build your user_config.h and user_modules.h file in your app/includes
directory. Maintain a user.cnf file in this directory and then run
tools/generate_user_modules.lua
from the root nodemcy directory. The cnf file contains directives of the following form,
and most have sensible defaults so only need to specify the ones that you want to override.
@TerryE
TerryE / enum_reg_funcs.lua
Created February 19, 2016 15:17
Module net leakgages
-- Q & D function form of require tk enumerate the regristry fu7nctions
return function(delim,nocall)
print( '+++'..(delim or '==============='))
for i = 1,3 do collectgarbage() end
for i,f in ipairs(debug.getregistry()) do
print (i,f)
if type(f)=='function' and not nocall then
uart.write(0, ' Dummmy -')
local ok, msg = pcall(f, 'socket','Data-'..i)
if not ok then print(msg) end
@TerryE
TerryE / benchmark.lua
Last active February 20, 2016 23:52
benchmark.lua
function benchmark(count1,count2,opt)
local workLoop,fn = [[
local x,clr,n = "",tmr.wdclr,...;
for i = 1, n,1 do x = x .. "."; if n%100 == 0 then clr() end end;
return x:len()
]]
file.open("test.lua","w"); file.writeline(workLoop); file.close()
if opt == 1 then
fn = loadstring(workLoop)
diff --git a/app/include/user_config.h b/app/include/user_config.h
index 8060253..9a07daf 100644
--- a/app/include/user_config.h
+++ b/app/include/user_config.h
@@ -42,6 +42,7 @@
#endif /* NODE_ERROR */
#define GPIO_INTERRUPT_ENABLE
+#define GPIO_INTERRUPT_HOOK_ENABLE
// #define GPIO_SAFE_NO_INTR_ENABLE
@TerryE
TerryE / LROR Paper.md
Last active July 1, 2017 11:20
LROR Paper.md

LROR (Lua Read-Only Resources) in NodeMCU Lua 5.3

Drafting Caveat

Updates since last realease:

  • Extra details on the multi-host make system
  • Extra details on the legacy module support and how this can be used to compile and run modules written for the Lua 5.1 version with no or minimal source changes.
  • Slight rework of ROTable implementation to support the same.