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 eth.vm.forks import ( | |
| IstanbulVM, | |
| ) | |
| from eth.vm import ( | |
| opcode_values | |
| ) | |
| from tests.core.opcodes.test_opcodes import ( | |
| assemble, | |
| CANONICAL_ADDRESS_B, |
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
| pps = [ | |
| '1-5 k: kkkkhkkkkkkkkkk', | |
| '5-7 k: blkqhtxfgktdkxzkksk', | |
| '15-16 x: xxxxxxxxxxxxxxlf', | |
| '3-5 j: fjpvj', | |
| '17-20 x: zsxjrxkgxxxxxxxmxgxf', | |
| '5-6 m: swjzmmmlx', | |
| '2-4 v: vqdn', | |
| '8-12 t: thllsbqtgdsf', | |
| '10-17 h: vpbrjcbhnwqhhphxjk', |
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
| pragma solidity ^0.5.16; | |
| contract DummyERC20 is ERC20 { | |
| function withdraw() external { | |
| uint256 amount = balances[msg.sender]; | |
| // demo reentracy | |
| require(msg.sender.call.value(amount)()); | |
| balances[msg.sender] = 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
| from eth_account import Account | |
| from eth_tester.backends.pyevm.main import get_default_account_keys | |
| acc = Account.from_key(get_default_account_keys()[0]) | |
| print(acc.key) |
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
| # Been a while since I made one of these. | |
| # The last time I made one, I was in college. | |
| def print_triangle(n: int): | |
| for i in range(1, n + 1): | |
| digits = len(str(n)) | |
| print((" " * (digits + 1)) * (n - i) , end="") | |
| for j in range(i): | |
| print(" %s" % str(j + 1).rjust(digits, "0"), end="") | |
| for j in range(i - 1): |
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 ones(n): | |
| return sum(10 ** i for i in range(n)) | |
| def print_pattern(n): | |
| for i in range(1, n+1): | |
| num = ones(i) | |
| print(" " * (2*(n-i)), end='') | |
| print(f"{num} x {num} = {num * num}", end="\n\n") |
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 repeating_digit(num: int) -> int: | |
| """ | |
| code inspired by | |
| The Reciprocals of Primes - Numberphile | |
| on youtube: https://www.youtube.com/watch?v=DmfxIhmGPP4&ab_channel=Numberphile | |
| Parameter | |
| num: a prime number | |
| returns: The number of repeating digits of reciprocal of a prime number |
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
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.7.5; | |
| import "forge-std/Test.sol"; | |
| import "forge-std/console.sol"; | |
| import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; | |
| import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; | |
| contract Greeter is Ownable { |
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
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.7.5; | |
| import "forge-std/Test.sol"; | |
| contract Greeter { | |
| string greeting; | |
| constructor(string memory _greeting) { |