Skip to content

Instantly share code, notes, and snippets.

Pedro Teixeira pgte

Block or report user

Report or block pgte

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pgte
pgte / peer-star-app.md
Last active Jun 27, 2018
peer-star-app
View peer-star-app.md
  • Released on June 27th 2018
  • Expires on July 31st 2018

peer-star-app for peer-star app developers

Hello peer-star app developer! 👋

In an effor to make PeerPad scale better for many users editing the same pad, over the last few weeks I've been focused on implementing the topology and protocol described here. This is materializing in the form of a package named peer-star-app.

View Keybase.md

Keybase proof

I hereby claim:

  • I am pgte on github.
  • I am pgte (https://keybase.io/pgte) on keybase.
  • I have a public key ASBfSphgzAav1T3NDE4lHUnF6XEjThKMBaMHdr0XUsH-nwo

To claim this, I am signing this object:

View routes.js
function someFn(req, res) {
// do stuff...
}
route('/someRoute', someFn);
@pgte
pgte / http-client-request-observe.js
Last active Aug 14, 2017
node request and response life cycle
View http-client-request-observe.js
var https = require('https');
var querystring = require('querystring');
var events = ['socket', 'connection', 'response', 'data', 'end', 'close', 'finish'];
var postData = querystring.stringify({
'msg' : 'Hello World!'
});
var options = {
View pet_projects.md

Kernelify

Node.js kernel generators.

Sombrero cluster

Have the node. Now need to figure out:

  • DHT-based sharding, Gossip and all that stuff
  • Proxy: Gossip client + reverse HTTP proxy
View npm output
npm http PUT https://registry.npmjs.org/nock
npm http 201 https://registry.npmjs.org/nock
npm http GET https://registry.npmjs.org/nock
npm http 200 https://registry.npmjs.org/nock
npm http PUT https://registry.npmjs.org/nock/-/nock-0.32.3.tgz/-rev/288-9c18881d4c96938b50a923918f2b06cb
npm http 502 https://registry.npmjs.org/nock/-/nock-0.32.3.tgz/-rev/288-9c18881d4c96938b50a923918f2b06cb
npm ERR! registry error parsing json
@pgte
pgte / personalized_sync_arch.md
Last active Aug 29, 2015
personalized sync
View personalized_sync_arch.md

Personalized Sync

The goal is for each client to have a local personalized copy of the database. This personal local database is a subset of all the existing documents. Clients can share documents or not.

Authenticated session and filters

Each client intiates an authenticated session with the server. On each session, server sets up personalized read and write filters. These filters only propagate changes that the user is allowed / interested in.

View auth.md

I built this service rendered over HTTPS.

We're using the Hawk protocol to authenticate message producers, but since the service will use HTTPS, Hawk is an overkill in my opinion.

Some of the drawbacks of using Hawk in my opinion:

  1. Signs whole message: overkill when you're using TLS
  2. Tries to be stateless on the server-side and implements a sort of message non-repeatability by including a timestamp inside the message. The timestamp has to be equal to the server-side time take or give 1 minute. This imposes time synchronizatin between client and server, which is hard to enforce.
View clone_zone.md

Recipe for customizing a SmartoOS image and cloning it

1. Create base image

1.1. Download and install the base image:

[root@00-0c-29-aa-24-ba ~]# imgadm list
UUID                                  NAME             VERSION  OS       PUBLISHED
9eac5c0c-a941-11e2-a7dc-57a6b041988f  base64           13.1.0   smartos  2013-04-26T15:17:57Z
You can’t perform that action at this time.