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
// Return a list of `params` to populate the [slug] dynamic segment | |
export async function generateStaticParams() { | |
return ['team1', 'team2'].map((team) => ({ | |
teamId: team, | |
})) | |
} | |
type Props = { | |
params: { | |
teamId: string |
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 cv2 | |
import sys | |
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.') | |
if __name__ == '__main__' : | |
# Set up tracker. | |
# Instead of CSRT, you can also use | |
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 json | |
from six.moves.urllib.request import urlopen | |
from functools import wraps | |
from flask import Flask, request, jsonify, _request_ctx_stack | |
from flask_cors import cross_origin | |
from jose import jwt | |
AUTH0_DOMAIN = 'AUTH0-DOMAIN' | |
API_IDENTIFIER = 'API-IDENTIFIER' |
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
pragma solidity ^0.6.6; | |
contract CoolNumberContract { | |
uint public coolNumber = 10; | |
function setCoolNumber(uint _coolNumber) public { | |
coolNumber = _coolNumber; | |
} | |
} |
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
pragma solidity ^0.4.24; | |
// ---------------------------------------------------------------------------- | |
// Sample token contract | |
// | |
// Symbol : LCST | |
// Name : LCS Token | |
// Total supply : 100000 | |
// Decimals : 2 | |
// Owner Account : 0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe |
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
def validate_chain(self, chain_to_validate): | |
""" | |
Verifies if a given chain is valid | |
:param chain_to_validate: <[Block]> | |
:return: <bool> True if the chain is valid | |
""" | |
# First validate both genesis blocks | |
if chain_to_validate[0].hash_block() != self.__chain[0].hash_block(): | |
return False |
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
def add_block(self, block): | |
""" | |
Creates a new block and passes it to the chain | |
:param block: <Block> Block to add to the chain | |
:return: <bool> True if the block is added to the chain, False if not. | |
""" | |
if self.validate_block(block, self.last_block): | |
self.__chain.append(block) |
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
def mine(self, reward_address): | |
""" | |
Mines a new block into the chain | |
:param reward_address: <str> address where the reward coin will be transferred to | |
:return: result of the mining attempt and the new block | |
""" | |
last_block = self.last_block | |
index = last_block.index + 1 | |
previous_hash = last_block.hash |
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
@staticmethod | |
def validate_proof_of_work(last_nonce, last_hash, nonce): | |
""" | |
Validates the nonce | |
:param last_nonce: <int> Nonce of the last block | |
:param nonce: <int> Current nonce to be validated | |
:param last_hash: <str> Hash of the last block | |
:return: <bool> True if correct, False if not. | |
""" |
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
def __init__(self): | |
self.__current_transactions = [] | |
self.__chain = [] | |
# Create genesis block | |
self.create_genesis() | |
def create_genesis(self): | |
""" | |
Creates the Genesis block and passes it to the chain |
NewerOlder