pragma solidity ^0.5.0;
library Adder {
function add(uint self, uint b) public pure returns (uint) {
return self + b;
}
}
contract Example {
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
$(document).ready(function (){ | |
// Get the image and canvas nodes | |
var img = $('#original_image')[0]; | |
var canvas = $('#original_canvas')[0]; | |
// confirm that the image has loaded | |
img.addEventListener("load", function() { | |
// set the canvas dimensions | |
canvas.width = img.width; | |
canvas.height = img.height; |
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
require("@nomiclabs/hardhat-waffle"); | |
require("@nomiclabs/hardhat-ethers"); | |
// This is a sample Hardhat task. To learn how to create your own go to | |
// https://hardhat.org/guides/create-task.html | |
task("accounts", "Prints the list of accounts", async () => { | |
const accounts = await ethers.getSigners(); | |
for (const account of accounts) { | |
console.log(account.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
import { Avalanche, BN, Buffer } from "avalanche/dist" | |
import { | |
AVMAPI, | |
KeyChain, | |
UTXOSet, | |
UnsignedTx, | |
Tx, | |
KeyPair, | |
SelectCredentialClass | |
} from "avalanche/dist/apis/avm" |
When you have a type which is an array of objects you can access the object's properties by using the dot notation. For example:
let foo = {
arrKey: [{key: "value"}]
}
foo.arrKey[0].key // "value"
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 { Avalanche, BN, Buffer } from "avalanche/dist" | |
import { | |
AVMAPI, | |
KeyChain, | |
UTXOSet, | |
UnsignedTx, | |
Tx | |
} from "avalanche/dist/apis/avm" | |
import { | |
GetBalanceResponse, |
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
# all the imports | |
import torch, time, math, os | |
# import specified modules | |
from torch import autocast | |
from diffusers import StableDiffusionPipeline | |
# confirm GPU supports the NVIDIA machine learning toolkit | |
assert torch.cuda.is_available() | |
# Stable Diffusion v1.4: CompVis/stable-diffusion-v1-4 |
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
# all the imports | |
import io, torch, time, math, os | |
# import specified modules | |
from flask import Flask, request, send_file | |
from torch import autocast | |
from diffusers import StableDiffusionPipeline | |
# create a new flask app | |
app = Flask(__name__) |
By default a new AWS EC2 instance only exposes port 22
to the Web to enable accessing the new EC2 instance via ssh
. Often it's helpful to open other ports to the Web so that you can access them via a browser. This tutorial shows 2 different ways of exposing ports on AWS EC2 instances.
Additionally if you're not interested in exposing a port to the Web but would still like to access it via your browser you can use port forwarding in VS Code which is covered in the final section below.
When launching a new EC2 instance, fill out the following items
NewerOlder