Skip to content

Instantly share code, notes, and snippets.

View daviddias's full-sized avatar

David Dias daviddias

View GitHub Profile
@daviddias
daviddias / distritos-concelhos-freguesias-Portugal.json
Created November 14, 2016 18:10 — forked from tomahock/distritos-concelhos-freguesias-Portugal.json
Level 1 = Distrito, Level 2 = Concelho, Level 3 = Freguesia. Update de 12-07-2016
[
{
"level": 1,
"code": 1,
"name": "Aveiro"
},
{
"level": 2,
"code": 101,
"name": "Águeda"
// This script counts how many days you have been in the USA
// This is a personal script, use it at your own risk
// This is not an official tool and it can do wrong calculations
// which might result in loss in visa status, green card, citizenship
// and whatever you can think of
// This extracts data from the i94 website from the history result view
function daysInYear(year) {
var recs = angular.element(".history-results").scope().vm.recs
function renameKeys (dict, keyMap) {
return _.reduce(dict, function (newDict, val, oldKey) {
var newKey
if (keyMap[oldKey]) {
newKey = keyMap[oldKey]
} else {
newKey = oldKey
}
newDict[newKey] = val
return newDict
js
├── actions
│   ├── config.js
│   ├── errors.js
│   ├── files.js
│   ├── index.js
│   ├── pages.js
│   ├── preview.js
│   ├── router.js
│   └── utils.js
```
it.only('sends the mss multicodec', (done) => {
const p = pullPair()
const dialer = multiplex.dialer(p[0])
const listener = multiplex.listener(p[1])
let dialerConn
let listenerConn
listener.on('stream', (conn) => {
/* eslint-env mocha */
/* eslint max-nested-callbacks: ["error", 8] */
'use strict'
const chai = require('chai')
chai.use(require('chai-checkmark'))
const expect = chai.expect
const pair = require('pull-pair/duplex')
const pull = require('pull-stream')
const parallel = require('async/parallel')
test('underlying error is propagated to muxed streams', function (t) {
t.plan(2)
var plex1 = multiplex()
var plex2 = multiplex()
var socket
plex2.on('stream', function (stream) {
console.log('stream incomming plex2')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/img/favicon.ico">
<title>SISE-CWEB</title>
@daviddias
daviddias / peermaps-data.md
Created December 19, 2016 02:42
peermaps p2p data format for ad-hoc openstreetmap extracts

peermaps data is ready

Peermaps is a project to bring OpenStreetMap data to the p2p web.

I've just finished a big part of this project: subdividing planet-latest.osm.pbf to support ad-hoc extracts. With ad-hoc extracts over p2p networks, you can download only the parts of planet osm that you need without having to download the whole 34G thing and process it using tens of gigabytes of RAM. Using the peermaps data archive, you can build tile sets for the entire planet on very modest hardware. Every .o5m.gz file is at most 1M. More details below.

message Message {
message Wantlist {
repeated Entry entries = 1; // a list of wantlist entries
optional bool full = 2; // whether this is the full wantlist. default to false
message Entry {
optional bytes block = 1; // the block key
optional bool cancel = 2; // whether this revokes an entry
}
}