Skip to content

Instantly share code, notes, and snippets.

@smcl
smcl / NLPTest.cs
Created May 23, 2016 19:40
Simple test of stanford NLP library - receive some input, then pretty print the NLP analysis.
using System;
using System.IO;
using java.util;
using java.io;
using edu.stanford.nlp.pipeline;
using Console = System.Console;
namespace NLPTest
{
class Program
@smcl
smcl / test.c
Last active April 16, 2016 13:19
// test.c - simple lua for playing about with
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
// test.identity() - takes a single value, returns it
static int test_identity(lua_State *L) {
return 1;
}
@smcl
smcl / user_modules.h
Created March 16, 2016 17:27
light user_modules.h for NodeMCU build
#ifndef __USER_MODULES_H__
#define __USER_MODULES_H__
#define LUA_USE_BUILTIN_STRING // for string.xxx()
#define LUA_USE_BUILTIN_TABLE // for table.xxx()
#define LUA_USE_BUILTIN_COROUTINE // for coroutine.xxx()
#define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work
// #define LUA_USE_BUILTIN_IO // for io.xxx(), partially work
// #define LUA_USE_BUILTIN_OS // for os.xxx(), not work
--wifi.setmode(wifi.STATION)
--wifi.sta.config("MyAccessPoint","mypassword")
hits = 0
server = net.createServer(net.TCP)
server:listen(80, function(conn)
conn:on("receive", function(conn, payload)
print(payload)
hits = hits + 1
<html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.6/zepto.min.js">
</script>
<script>
function toggleLED() {
$.post("/", {}, function(response){
location.reload();
});
}
--wifi.setmode(wifi.STATION)
--wifi.sta.config("MyAccessPoint","mypassword")
led = 4
ledStatus = gpio.HIGH
gpio.mode(led, gpio.OUTPUT)
file.open("led.html")
htmlTemplate = file.read()
file.close()
diff --git a/app/include/lwip/app/ping.h b/app/include/lwip/app/ping.h
index 21e26e9..161b7ab 100644
--- a/app/include/lwip/app/ping.h
+++ b/app/include/lwip/app/ping.h
@@ -75,6 +75,7 @@ struct ping_resp{
uint32 bytes;
uint32 total_bytes;
uint32 total_time;
+ uint8 ttl;
sint8 ping_err;
@smcl
smcl / init.lua
Last active January 26, 2016 16:49
-- init.lua
--
-- Simple lua script to get started. Will blink the esp8266's
-- onboard LED while not connected to a wifi access point, and
-- keep it lit up after a connection is established
seconds = 1000
ledBlinkTimer = 1
ledBlinkTimeout = seconds / 10
void drawProjectedLine(point3D_type from, point3D_type to) {
from.z += CAM_F;
to.z += CAM_F;
int x1_2D = CAM_X + (int)(((double)from.x / (double)from.z) * CAM_F);
int y1_2D = CAM_Y + (int)(((double)from.y / (double)from.z) * CAM_F);
int x2_2D = CAM_X + (int)(((double)to.x / (double)to.z) * CAM_F);
int y2_2D = CAM_Y + (int)(((double)to.y / (double)to.z) * CAM_F);
#!/bin/bash
numberFiles=`ls ./srt/*.srt | wc -w | tr -d '[[:space:]]'`
seq -s ' ' $numberFiles
printf "\n"
find ./srt/* | while read s
do
grep -io harvard "${s}" | wc -w | tr -d '[[:space:]]'
printf " "