This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flask | |
app = flask.Flask(__name__) | |
app.config["DEBUG"] = True | |
@app.route('/', methods=['GET']) | |
def home(): | |
return "<h1>Distant Reading Archive</h1><p>This site is a prototype API for distant reading of science fiction novels.</p>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"issuer": "MagnetoCorp", | |
"paperNumber": "123", | |
"issueDateTime": "2020-05-31", | |
"maturityDateTime": "2020-11-30", | |
"faceValue": "2000" | |
} | |
{ | |
"issuer": "MagnetoCorp", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./byfn.sh down | |
./byfn.sh up | |
docker exec -it cli bash | |
**next commands are run from the peer cli** | |
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp | |
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git commit -s -m "[FAB-13903] typo...etc" // this is so gerrit connects back to jira issue: https://jira.hyperledger.org/browse/FAB-13903 | |
$ git push origin HEAD:refs/for/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const { Contract } = require('fabric-contract-api'); | |
class MyContract extends Contract { | |
//add a member along with their email, name, address, and number | |
async addMember(ctx, email, name, address, phoneNumber) { | |
let member = { | |
name: name, | |
address: address, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is the module that helps us make API calls (requests) | |
import requests | |
# this module helps us print all aspects of the data returned from API call | |
from pprint import pprint | |
# to make a different API call, just change the url below to a API endpoint. Two examples, one pokemon, one for longitude and latitude | |
# response = requests.get("http://api.open-notify.org/iss-now.json") | |
response = requests.get("https://pokeapi.co/api/v2/pokemon/ditto") | |
pprint(vars(response)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------------------------------------- | |
--------------------------commands for Part 1 in YouTube tutorial starts here--------------------------------- | |
-------------------------------------------------------------------------------------------------------------- | |
//first need to clone directory to get all the needed files to deploy our blockchain network. All smart contract files are in contract directory | |
$ git clone https://github.com/IBM/blockchainbean.git | |
//install dependencies that we will use later | |
$ npm install -g [email protected] | |
$ npm install -g @ampretia/composer-wallet-cloudant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require("request"); | |
function translate(userInput) { | |
return new Promise((resolve, reject) => { | |
var data = {}; | |
//Translate from en -> es (English to Spanish) | |
data.source = "en"; | |
data.target = "es"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var context = {}; | |
conversation.message({ | |
workspace_id: "your workspace id", | |
input: {"text": "translate this phrase."}, | |
context: context | |
}, function(err, response) { | |
if (err) | |
console.log("error:", err); | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var watson = require("watson-developer-cloud"); | |
var conversation = watson.conversation({ | |
username: "Watson conversation username here", | |
password: "Watson conversation password here", | |
version: "v1", | |
version_date: "2017-05-26" | |
}); |