Skip to content

Instantly share code, notes, and snippets.

View pebsconsulting's full-sized avatar

Georgi Tsochev pebsconsulting

  • PEBS-Management Consulting LTD
  • Sofia
View GitHub Profile
@pebsconsulting
pebsconsulting / keybase.md
Created December 6, 2018 06:27 — forked from joeltg/keybase.md
Keybase verification

Keybase proof

I hereby claim:

  • I am joeltg on github.
  • I am joelg (https://keybase.io/joelg) on keybase.
  • I have a public key ASAT5TnVT1VjbgzrxQPWCTHhakVO_WvhLQ2fWl2pFMnUPwo

To claim this, I am signing this object:

@pebsconsulting
pebsconsulting / persist.js
Created December 6, 2018 06:27
Persist a JSON-LD document to IPLD
const jsonld = require("jsonld")
const dagPB = require("ipld-dag-pb")
const dagOptions = { format: "dag-pb", hashAlg: "sha2-256" }
function parseJSON(bytes, callback) {
const string = bytes.toString("utf8")
let res = null,
error = null
try {
@pebsconsulting
pebsconsulting / notes-roadmap.md
Created December 6, 2018 06:26 — forked from joeltg/notes-roadmap.md
Technical Notes and Roadmap for the Underlay

Technical Notes and Roadmap

Data model

Split into two stages to allow IPLD to develop further:

  1. Now: JSON-LD file-based model. JSON-LD is the future of RDF and it's already popular. The simplest, most future-friendly and semantically-idiomatic model to get the Underlay started now is to publish JSON-LD files that:
  • are flattened relative to one top-level context,
  • address every node with either absolute or fragment-relative URIs (no blank or path-relative nodes),
  • link to other nodes with the IPFS URI scheme dweb:/ipfs/Qm..., using fragments for nodes within documents: dweb:/ipfs/Qm...#node-id
  • use the PROV vocabulary with named graphs to capture "first-class" provenance as JSON-LD itself
  • are persisted to IPFS with the files API, and

Underlay Interfaces

Every interface implementation is a class with at least two static properties type: string[] and data: {[property: string]: string}, and (depending on the interface(s) it implements) zero or more public async functions. Every interface class will be constructed with new Class(options: {}).

Namespace

Indicates a service that manages some context-scoped concept of identity

  • type: ["http://underlay.mit.edu/interface/namespace"]
  • data.namespace: string
    • a static property containing the URI of the namespace indexed by the resolver
    • "http://www.wikidata.org/"
@pebsconsulting
pebsconsulting / setup.sh
Created December 6, 2018 06:26 — forked from joeltg/setup.sh
Setup for IPFS Cluster Node (Linode w/ Debian 9)
apt update
apt upgrade -y
apt install -y make git jq
wget https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.11.1.linux-amd64.tar.gz
rm go1.11.1.linux-amd64.tar.gz
echo "export PATH=\$PATH:/usr/local/go/bin:/root/go/bin" >> /etc/profile
source /etc/profile
go get -u github.com/ipfs/ipfs-update
ipfs-update install latest

Schema translations

I'm going to use the words "schema" and "ontology" interchangeably and there's nothing you can do to stop me.

There's lots of structured data out in the wild, but it's only structured internally, relative to itself. For example, IMDB will let you download CSVs of its archives, but they're in IMDB's own schema, with made-up IMDB names for all the columns. If you're consuming their data, you still need to read their interface docs and transform the data into an externally compatible format. Their data is only usable intentionally.

What we'd really love is for data to also be usable incidentally - reachable, retrievable, and interpretable from outside worlds without any human in the loop. One way to achieve this is through standardization (getting IMDB to switch all their property names to fully-qualified URIs in some standardized movie-ish ontology), but a far more practical & scalable strategy is through self-des

package loader
import (
"io"
"net/url"
ipfs "github.com/ipfs/go-ipfs-api"
"github.com/piprate/json-gold/ld"
)
if ( $post->post_parent )
{
wp_redirect( get_permalink( $post->post_parent ), 301 );
}
else
{
wp_redirect( site_url(), 301 ) );
}
die();
@pebsconsulting
pebsconsulting / String.prototype.template.js
Created October 2, 2018 06:27 — forked from WebReflection/String.prototype.template.js
ES6 Template like strings in ES3 compatible syntax.
// this is now a module:
// https://github.com/WebReflection/backtick-template#es2015-backticks-for-es3-engines--
var template = require('backtick-template');
// just string
const info = 'template';
`some ${info}` === template('some ${info}', {info});
@pebsconsulting
pebsconsulting / FileDownloader.cs
Created July 26, 2018 02:00 — forked from yasirkula/FileDownloader.cs
C# Download Public File From Google Drive™ (works for large files as well)
using System;
using System.IO;
using System.Net;
public static class FileDownloader
{
private const string GOOGLE_DRIVE_DOMAIN = "drive.google.com";
private const string GOOGLE_DRIVE_DOMAIN2 = "https://drive.google.com";
// Normal example: FileDownloader.DownloadFileFromURLToPath( "http://example.com/file/download/link", @"C:\file.txt" );