Skip to content

Instantly share code, notes, and snippets.

View mralexgray's full-sized avatar

Alex Gray mralexgray

View GitHub Profile
@mralexgray
mralexgray / proxy.coffee
Last active July 11, 2016 05:05 — forked from richardkazuomiller/proxy.js
node-http-proxy routing proxy with websockets
httpProxy = require 'http-proxy'
proxy = httpProxy.createProxy ws:true
options =
'herp.dev': 'http://0.0.0.0:9008'
'derp.dev': 'http://0.0.0.0:3000'
server = require('http').createServer (req, res) ->
proxy.web req, res, { target: options[req.headers.host] }, (e) ->
log_error e, req
log_error = (e, req) -> return if not e
@mralexgray
mralexgray / cs-jq-plugin-template.coffee
Last active June 9, 2016 03:24 — forked from rjz/cs-jq-plugin-template.coffee
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
do($ = window.jQuery, window) ->
@mralexgray
mralexgray / exported.coffee
Created May 10, 2016 09:34
Simple coffee-script class definition, module export, and example usage.
r = require 'events'
class Hello extends r
greet: () ->
console.log 'hello'
@emit 'greeted'
#include <inttypes.h>
#include <stdio.h> // for size_t
class Outputter;
class Printable { public:
virtual void printTo(Outputter &stream) const = 0;
};
class Outputter { public:
@mralexgray
mralexgray / switchs.h
Created February 19, 2016 00:19 — forked from develhox/switchs.h
Switch operand implementation for the strings
#ifndef __SWITCHS_H__
#define __SWITCHS_H__
#include <string.h>
#include <regex.h>
#include <stdbool.h>
/** Begin a switch for the string x */
#define switchs(x) \
{ char *__sw = (x); bool __done = false; bool __cont = false; \
@mralexgray
mralexgray / ESPWebFramework.make.log
Created January 24, 2016 12:16
ESPWebFramework result of clean build, but unresponsive web interface
make flash
xtensa-lx106-elf-g++ -g -save-temps -Os -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -I /ESPWebFramework/SDK/esp_iot_rtos_sdk-master/include -I /ESPWebFramework/SDK/esp_iot_rtos_sdk-master/include/espressif -I /ESPWebFramework/SDK/esp_iot_rtos_sdk-master/extra_include -I /ESPWebFramework/SDK/esp_iot_rtos_sdk-master/include/lwip -I /ESPWebFramework/SDK/esp_iot_rtos_sdk-master/include/lwip/lwip -I /ESPWebFramework/SDK/esp_iot_rtos_sdk-master/include/lwip/ipv4 -I /ESPWebFramework/SDK/esp_iot_rtos_sdk-master/include/lwip/ipv6 -I /ESPWebFramework/SDK/xtensa-lx106-elf/xtensa-lx106-elf/include -c src/user_main.cpp -o user_main.o
xtensa-lx106-elf-g++ -g -save-temps -Os -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH -fno-exceptions -fno-rtti -fno-threadsafe-statics
@mralexgray
mralexgray / 0x00000.bin
Created January 3, 2016 08:36 — forked from ajfisher/0x00000.bin
ESP8266 Transparent bridge to J5
#include <stdio.h>
#include <locale.h>
int main() {
stdout = freopen("/private/tmp/uni.c", "w", stderr);
fprintf(stderr, "// clang valid idntifier test\n\n");
setlocale(LC_ALL, "");
for (int i = 0; i < 0xffff; i++) fprintf(stderr,"#define %lc\tU%x\n", i, i);
This file has been truncated, but you can view the full file.
// clang valid idntifier test
#define U0
#define  U1
#define  U2
#define  U3
#define  U4
#define  U5
#define  U6
#define  U7