Skip to content

Instantly share code, notes, and snippets.

View JohnMcLear's full-sized avatar
🌴
On vacation

John McLear JohnMcLear

🌴
On vacation
View GitHub Profile
#include <EEPROM.h>
/**************************************************************************/
/*!
This example will attempt to connect to an ISO14443A
card or tag and retrieve some basic information about it
that can be used to determine what type of card it is.
Note that you need the baud rate to be 115200 because we need to print
out the data and read from the card at the same time!
@JohnMcLear
JohnMcLear / posa.mkdn
Created December 5, 2012 16:42 — forked from audreyt/posa.mkdn
EtherCalc Chapter for POSA

From SocialCalc to EtherCalc

Previously, in The Architecture of Open Source Applications, I described SocialCalc, an in-browser spreadsheet system that replaced the server-centric WikiCalc architecture. SocialCalc performs all of its computations in the browser; it uses the server only for loading and saving spreadsheets.

For the Socialtext team, performance was the primary goal behind SocialCalc's design in 2006. The key observation was this: Client-side computation in JavaScript, while an order of magnitude slower than server-side computation in Perl, was still much faster than the network latency incurred during AJAX roundtrips:

...diagram on SocialCalc's scalability model... (Since that time, advances in JavaScript runtimes have mostly closed the gap; note that in the diagram.)

Toward the end of the AOSA chapter, we introduced simultaneous collaboration on spreadsheets, using a simple, chatroom-like architecture:

body{
color:red;
}
var ss = require('slideshow');
var slideshow = new ss("powerpoint");
// content of index.js
const http = require('http')
const port = 3000
const requestHandler = (request, response) => {
console.log(request.url)
if(request.url.indexOf("next") !== -1){
// in ES6
import { NFC } from 'nfc-pcsc';
// without Babel in ES2015
const { NFC } = require('nfc-pcsc');
const nfc = new NFC(); // optionally you can pass logger
nfc.on('reader', reader => {
const pcsclite = require('pcsclite');
const pcsc = pcsclite();
pcsc.on('reader', function(reader) {
console.log('New reader detected', reader.name);
reader.on('error', function(err) {
console.log('Error(', this.name, '):', err.message);
var pcsc = require('pcsclite');
var pcsc = pcsc();
pcsc.on('reader', function(reader) {
console.log('New reader detected', reader.name);
reader.on('error', function(err) {
console.log('Error(', this.name, '):', err.message);
});
GNU nano 2.9.3 examples/uid-logger.js Modified
"use strict";
// #############
// Logs cards' uid
// #############
const { NFC, TAG_ISO_14443_3, TAG_ISO_14443_4, KEY_TYPE_A, KEY_TYPE_B } = require('nfc-pcsc');
const sqlite3 = require('sqlite3');
// IsoDep -- Smart Cards etc.
try {
await nfc.connect('android.nfc.tech.IsoDep', 500);
var response = await nfc.transceive("80 CA 9F 7F 2C"); // GTO
checkUID(response, "IsoDep");
response = await nfc.transceive("80 02 00 00 16"); // MultOS
var ueberDB = require("ueberdb2");
var settings = {
"dbType" : "mysql",
"dbSettings" : {
"user": "jose",
"host": "localhost",
"port": 3306,
"password": "password",
"database": "etherpad_lite_db",