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
const Web3 = require("web3"); | |
const web3 = new Web3(new Web3.providers.HttpProvider('https://api.avax-test.network/ext/bc/C/rpc')); | |
let account = web3.eth.accounts.privateKeyToAccount(yourPrivateKey); | |
let address = account["address"]; | |
let accsign = account["signTransaction"]; // function for signing transactions | |
chain = {name: "fuji", networkId: 1, chainId: 43113}; //chain information | |
mycommon = {customChain:chain}; |
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
contract Base{ | |
event Transfer(address from, address to, uint256 tokenId); | |
mapping (uint256 => address) public IndexToOwner; | |
mapping (address => uint256) public ownershipTokenCount; | |
mapping (uint256 => address) public IndexToApproved; | |
function getMyTokens(address myaddress) view public returns(uint[] memory){ | |
uint num = ownershipTokenCount[myaddress]; | |
uint found = 0; |
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
using DataFrames | |
using CSV | |
using Random | |
using LinearAlgebra | |
redwine = DataFrames.DataFrame(CSV.File("winequality-red.csv")) | |
mat = Matrix(redwine)[:, 1:11] | |
A = mat[:, 1:end-1] #features | |
y = mat[:, end]; #labels |
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
x = diag(ones(10000, 1)) % matrix with ones on diagonal and zero elsewhere | |
z = sparse(x) % compressed adjacency list representation |
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
t = 0:.05:20; | |
y = exp(t); | |
i = 0; | |
for t = 0:.05:20 | |
i = i + 1; | |
y(i) = exp(t); | |
end |
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
ddddd |
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
a = rand(500, 500) | |
b = rand(500, 500) | |
c = rand(500, 1) | |
a*b*c % O(N^3) time complexity | |
a*(b*c) % O(N^2) time complexity |
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
x = [1, 1]; | |
for k = 3:1000000 | |
x(k) = x(k-1) + x(k-2); | |
end | |
x = zeros(1000000, 1); x(1:2) = [1, 1] | |
for k = 3:1000000 | |
x(k) = x(k-1) + x(k-2); | |
end |
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
parfor i = 1:100 | |
A(i) = eig(rand(500)) | |
end |
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
encounter(a::Person, b::Person) = "hello" | |
encounter(a::Person, b:: Tourist) = "takes picture" | |
encounter(a::Person, b::Person, c::Person) = "converses" | |
dine(a::Tourist) = "picks up fork" |