Skip to content

Instantly share code, notes, and snippets.

David Dias daviddias

Block or report user

Report or block daviddias

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
View i94-count-days-in-usa.js
// 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
View renameKeys.js
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
View webui-tree.sh
js
├── actions
│   ├── config.js
│   ├── errors.js
│   ├── files.js
│   ├── index.js
│   ├── pages.js
│   ├── preview.js
│   ├── router.js
│   └── utils.js
View gist:4fe5f6f99e99cfa7940a6f16d96568ea
```
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) => {
View aaaaaaa.js
/* 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')
View test.js
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')
View thisishtml.html
<!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 Dec 19, 2016 — forked from substack/peermaps-data.md
peermaps p2p data format for ad-hoc openstreetmap extracts
View peermaps-data.md

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.

@daviddias
daviddias / distritos-concelhos-freguesias-Portugal.json
Created Nov 14, 2016 — forked from tomahock/distritos-concelhos-freguesias-Portugal.json
Level 1 = Distrito, Level 2 = Concelho, Level 3 = Freguesia. Update de 12-07-2016
View distritos-concelhos-freguesias-Portugal.json
[
{
"level": 1,
"code": 1,
"name": "Aveiro"
},
{
"level": 2,
"code": 101,
"name": "Águeda"
View eth-block-message.proto
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
}
}
You can’t perform that action at this time.