import { createServer } from "http";
import crypto from "crypto";
const PORT = 8001;
// this is from the web-socket specification and not something that is generated
const WEBSOCKET_MAGIC_STRING_KEY = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
This file contains hidden or 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 logging | |
import os | |
import grpc | |
from protos import hello_pb2, hello_pb2_grpc | |
def get_filepath(filename, extension): | |
return f'{filename}{extension}' | |
def read_iterfile(filepath, chunk_size=1024): |
This file contains hidden or 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
from concurrent import futures | |
import logging | |
import os | |
import grpc | |
from protos import hello_pb2, hello_pb2_grpc | |
def get_filepath(filename, extension): | |
return f'{filename}{extension}' |
This file contains hidden or 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
def get_filepath(filename, extension): | |
return f'{filename}{extension}' | |
class Greeter(hello_pb2_grpc.GreeterServicer): | |
.... | |
def UploadFile(self, request_iterator, context): | |
data = bytearray() | |
filepath = 'dummy' |
This file contains hidden or 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 logging | |
import os | |
import grpc | |
from protos import hello_pb2, hello_pb2_grpc | |
def run(): | |
with grpc.insecure_channel('localhost:50051') as channel: | |
stub = hello_pb2_grpc.GreeterStub(channel) | |
response = stub.SayHello(hello_pb2.HelloRequest(name='John Doe', age=30)) | |
print("Greeter client received: " + response.message) |
This workshop is targeted at developers who are transitioning from Web2 to Web3 or have just recently gotten into Web3 and are looking to have a well-rounded foundation.
This first workshop is Series 1 in the three-part series that aims to introduce you to the blockchain and how to build on the blockchain.
This file contains hidden or 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
from flask import Flask, jsonify, request | |
from flask_sqlalchemy import SQLAlchemy | |
import uuid | |
app = Flask(__name__) | |
db = SQLAlchemy(app) | |
app.config['SECRET_KEY']='secret' | |
app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///app.db' |
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
docker --version
docker container --help