Skip to content

Instantly share code, notes, and snippets.

Avatar
💭

vasa vasa-develop

💭
View GitHub Profile
@vasa-develop
vasa-develop / go-snippet-3.go
Created Jan 4, 2020
SimpleAsWater: Hands-on IPLD Tutorial in Golang
View go-snippet-3.go
// Converting into JSON object
entryJSON, err := json.Marshal(m)
if err != nil {
fmt.Println(err)
}
// Display the marshaled JSON object before sending it to IPFS
jsonStr := string(entryJSON)
fmt.Println("The JSON object of your key-value entry is:")
fmt.Println(jsonStr)
@vasa-develop
vasa-develop / go-snippet-2.go
Created Jan 4, 2020
SimpleAsWater: Hands-on IPLD Tutorial in Golang
View go-snippet-2.go
scanner := bufio.NewScanner(os.Stdin)
fmt.Println("Enter value for the key field: ")
scanner.Scan()
inputKey := scanner.Text()
fmt.Println("Enter value for value field: ")
scanner.Scan()
inputValue := scanner.Text()
// Setting the key and values in the mapping
m[inputKey] = inputValue
@vasa-develop
vasa-develop / go-snippet-1.go
Created Jan 4, 2020
SimpleAsWater: Hands-on IPLD Tutorial in Golang
View go-snippet-1.go
// Mapping-based structure to record key-value information
keyValueMap := make(map[string]interface{})
@vasa-develop
vasa-develop / full-earth.js
Created Dec 28, 2019
SimpleAsWater: Building a Chat Application using Libp2p
View full-earth.js
'use strict'
/* eslint-disable no-console */
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const Node = require('./libp2p_bundle')
const pull = require('pull-stream')
const async = require('async')
const chalk = require('chalk');
const emoji = require('node-emoji')
@vasa-develop
vasa-develop / full-moon.js
Created Dec 28, 2019
SimpleAsWater: Building a Chat Application using Libp2p
View full-moon.js
'use strict'
/* eslint-disable no-console */
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const Node = require('./libp2p_bundle')
const pull = require('pull-stream')
const Pushable = require('pull-pushable')
const p = Pushable()
const chalk = require('chalk');
@vasa-develop
vasa-develop / moon_03.js
Created Dec 28, 2019
SimpleAsWater: Building a Chat Application using Libp2p
View moon_03.js
'use strict'
/* eslint-disable no-console */
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const Node = require('./libp2p_bundle')
const pull = require('pull-stream')
const Pushable = require('pull-pushable')
const p = Pushable()
const chalk = require('chalk');
const emoji = require('node-emoji')
@vasa-develop
vasa-develop / earthId.json
Created Dec 28, 2019
SimpleAsWater: Building a Chat Application using Libp2p
View earthId.json
{
"id": "Qma3GsJmB47xYuyahPZPSadh1avvxfyYQwk8R3UnFrQ6aP",
"privKey": "CAASpwkwggSjAgEAAoIBAQCaNSDOjPz6T8HZsf7LDpxiQRiN2OjeyIHUS05p8QWOr3EFUCFsC31R4moihE5HN+FxNalUyyFZU//yjf1pdnlMJqrVByJSMa+y2y4x2FucpoCAO97Tx+iWzwlZ2UXEUXM1Y81mhPbeWXy+wP2xElTgIER0Tsn/thoA0SD2u9wJuVvM7dB7cBcHYmqV6JH+KWCedRTum6O1BssqP/4Lbm2+rkrbZ4+oVRoU2DRLoFhKqwqLtylrbuj4XOI3XykMXV5+uQXz1JzubNOB9lsc6K+eRC+w8hhhDuFMgzkZ4qomCnx3uhO67KaICd8yqqBa6PJ/+fBM5Xk4hjyR40bwcf41AgMBAAECggEAZnrCJ6IYiLyyRdr9SbKXCNDb4YByGYPEi/HT1aHgIJfFE1PSMjxcdytxfyjP4JJpVtPjiT9JFVU2ddoYu5qJN6tGwjVwgJEWg1UXmPaAw1T/drjS94kVsAs82qICtFmwp52Apg3dBZ0Qwq/8qE1XbG7lLyohIbfCBiL0tiPYMfkcsN9gnFT/kFCX0LVs2pa9fHCRMY9rqCc4/rWJa1w8sMuQ23y4lDaxKF9OZVvOHFQkbBDrkquWHE4r55fchCz/rJklkPJUNENuncBRu0/2X+p4IKFD1DnttXNwb8j4LPiSlLro1T0hiUr5gO2QmdYwXFF63Q3mjQy0+5I4eNbjjQKBgQDZvZy3gUKS/nQNkYfq9za80uLbIj/cWbO+ZZjXCsj0fNIcQFJcKMBoA7DjJvu2S/lf86/41YHkPdmrLAEQAkJ+5BBNOycjYK9minTEjIMMmZDTXXugZ62wnU6F46uLkgEChTqEP57Y6xwwV+JaEDFEsW5N1eE9lEVX9nGIr4phMwKBgQC1TazLuEt1WBx/iUT83ita7obXqoKNzwsS/MWfY2innzYZKD
@vasa-develop
vasa-develop / earth01.js
Created Dec 28, 2019
SimpleAsWater: Building a Chat Application using Libp2p
View earth01.js
'use strict'
/* eslint-disable no-console */
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const Node = require('./libp2p_bundle')
const async = require('async')
const chalk = require('chalk');
const emoji = require('node-emoji')
let moonPeerId
async.parallel([
@vasa-develop
vasa-develop / default_opts.js
Created Dec 28, 2019
SimpleAsWater: Building a Chat Application using Libp2p
View default_opts.js
const DEFAULT_OPTS = {
modules: {
transport: [
TCP
],
connEncryption: [
SECIO
],
streamMuxer: [
Multiplex
@vasa-develop
vasa-develop / seccom-snippet.js
Created Dec 28, 2019
SimpleAsWater: Building a Chat Application using Libp2p
View seccom-snippet.js
const Multiplex = require('libp2p-mplex')
const SECIO = require('libp2p-secio')