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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.19; | |
import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; | |
import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; | |
abstract contract CadenceRandomConsumer { | |
struct Request { | |
uint64 flowHeight; | |
uint256 evmHeight; |
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
/// Computes the longest proper prefix which is suffix (LPS) array | |
/// | |
access(all) fun computeLPSArray(w: String, m: Int): [Int] { | |
var len: Int = 0 | |
let lps: [Int] = [0] | |
var i: Int = 1 | |
while i < m { | |
if w.length > i && w[i] == w[len] { | |
len = len + 1 |
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 requests | |
import time | |
# Add the model ID and your Hugging Face Token | |
HF_TOKEN = "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" | |
# MODEL = "cardiffnlp/twitter-roberta-base-sentiment-latest" | |
SENTIMENT_MODEL = "cardiffnlp/twitter-xlm-roberta-base-sentiment" | |
# Create the API request | |
API_BASE = "https://api-inference.huggingface.co/models/" | |
SENTIMENT_API_URL = API_BASE + SENTIMENT_MODEL |
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 FungibleToken from 0xFUNGIBLETOKEN | |
/// Quick resource implementation defining a wrapped Provider Capability | |
/// with a withdrawal limit, the wrapping resource itself implementing | |
/// the FungibleToken.Provider standard. | |
/// | |
pub contract ScopedFungibleToken { | |
pub let ScopedProviderStoragePath: StoragePath | |
pub let ScopedProviderPrivatePath: PrivatePath |