Skip to content

Instantly share code, notes, and snippets.

View jimpick's full-sized avatar
💭
Hi!

Jim Pick jimpick

💭
Hi!
View GitHub Profile
@roccomuso
roccomuso / index.html
Last active April 10, 2018 18:44
p2p-graph esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
<style>
body{
background-color: #7f7a7a;
};
@ldez
ldez / gmail-github-filters.md
Last active April 5, 2026 08:25
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label

Using Dat with a github.io domain

https://i.imgur.com/akOrIOq.png

My personl site is hosted at hashbase.io (link) so that you can access it via dat and https. My canonical dat url is dat://pfrazee.hashbase.io.

Before I used hashbase I used Github Pages, and today it dawned on me that I can have dat://pfrazee.github.io work too. It's pretty simple if you know the dat dns spec.

All I had to do was add /.well-known/dat to my site (click to view). I put the raw dat URL of my site in that file, along with a TTL.

@cblgh
cblgh / dat-quickstart.md
Last active May 1, 2018 19:29
make the p2p web with dat's primitives

low level primitives (in ascending abstraction)

  • hypercore works with individual posts in an append-only feed
  • hyperdrive abstracted filestore / works with files
  • hyperdiscovery create p2p swarms for hypercores, hyperdrives, and hyperdbs
  • hyperdb key-value database

higher level abstractions

  • webdb database; basically a document(?) store
  • dat-node built ontop of hypercore & hyperdrive, abstracts a bunch of stuff; less complex but also less flexible

Transferring your dats from one beaker to another

WARNING 1. If you do this, it MUST be either a transfer or a backup. Don't do this to run your Dats from two different computers. The Dat protocol doesn't support multiple computers running a Dat at the same time (yet) and you WILL corrupt your data.

WARNING 2. This will nuke the data in your new install.

WARNING 3. I havent actually tried this. Good luck!

If you're using Beaker 0.7.x, you'll need to copy part of your Beaker app data, and then your library folder (~/Sites).

@mattdesl
mattdesl / README.md
Last active July 22, 2019 06:31
wasm + budo/browserify
// control the session data on your connection
experimental.datPeers.getSessionData()
experimental.datPeers.setSessionData(obj) // obj must be no larger than 255 bytes when JSONified
// manage connected peers
var peers = experimental.datPeers.list() // list all peers connected to the current page's dat
var peer = experimental.datPeers.get(peerId)
await experimental.datPeers.broadcast(data) // send a message to all peers
experimental.datPeers.addEventListener('connect') // new peer
experimental.datPeers.addEventListener('disconnect') // peer closed connection
const crypto = require('crypto'),
sha = crypto.createHash('sha1'),
hyperdb = require('hyperdb'),
hyperdiscovery = require('hyperdiscovery'),
cms = require('random-access-idb')('cms'),
webrtc = require('webrtc-swarm'),
signalhub = require('signalhub'),
hyperdrive = require('hyperdrive'),
pump = require('pump');
var sha = require('sha.js')
var umkv = require('unordered-materialized-kv')
var EventEmitter = require('events').EventEmitter
module.exports = ContentAddressableStore
function ContentAddressableStore (db, opts) {
var kv = umkv(db)
var events = new EventEmitter()
opts = opts || {}