- openport
- netcat
NB: server and client can be the same machine.
NB: on first Openport run it's necessary to visit a URL before traffic will be forwarded
NB: server and client can be the same machine.
NB: on first Openport run it's necessary to visit a URL before traffic will be forwarded
DROP TABLE IF EXISTS student; | |
CREATE TABLE student ( | |
id SERIAL PRIMARY KEY, | |
name VARCHAR(255), | |
state JSONB | |
); | |
INSERT INTO student (name, state) VALUES ('Bob', '{"completed": []}'); |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
static int do_sub(const char *key, size_t key_len, char *buffer, size_t buffer_len) { | |
if (strncmp("HWVERSION", key, key_len) == 0) { | |
return snprintf(buffer, buffer_len, "%d.%d.%d", 1, 2, 3); | |
} else if (strncmp("xyzzy", key, key_len) == 0) { | |
return snprintf(buffer, buffer_len, "%s", "quux"); | |
} else { |
database(:db, adapter: :pg, host: '127.0.0.1', port: 5432) do | |
# reset logic here? | |
end | |
http_endpoint(:api, '127.0.0.1', 8000) do |addr, port| | |
working_dir ".." | |
run "build/api-server" | |
env LISTEN: "#{addr}:#{port}" | |
end |
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness" | |
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness" |
template <HardwareSerial* T> | |
class SerialWriter | |
{ | |
public: | |
void writeMessage(unsigned char *message, int length); | |
}; | |
template <HardwareSerial* T> | |
void SerialWriter<T>::writeMessage(unsigned char *message, int length) { | |
T->write(SafeSerial::MESSAGE_START); |
module.exports = function(cb) { | |
let state = 'idle', cancel = null, pending = null; | |
function submit(promise) { | |
let cancelled = false; | |
promise.then((res) => { | |
if (!cancelled) { | |
cb(res); | |
oncomplete(); | |
} |
function createTransport({fps, reset, update, draw}) { | |
const [UNKNOWN, READY, RUNNING] = enumeration('UNKNOWN', 'READY', 'RUNNING'); | |
const frameLength = Math.floor(1000 / fps); | |
const clock = {dt: null}; | |
let state = UNKNOWN, timer = null, lastFrame = null, nextFrame = null; | |
function _start() { | |
if (state === RUNNING) return; | |
if (state === UNKNOWN) _reset(); |
function enumeration() { | |
const out = []; | |
for (let ix = 0; ix < arguments.length; ++ix) { | |
let val = {}; | |
Object.defineProperty(val, 'name', { | |
value: arguments[ix], | |
writable: false, | |
configurable: false | |
}); | |
out.push(val); |