Skip to content

Instantly share code, notes, and snippets.

View partylikeits1983's full-sized avatar
🧮

Alexander John Lee partylikeits1983

🧮
View GitHub Profile
pragma solidity 0.6.11;
// https://ethereum.org/en/developers/docs/smart-contracts/
contract VendingMachine {
// Declare state variables of the contract
address public owner;
mapping (address => uint) public cupcakeBalances;
// When 'VendingMachine' contract is deployed:
// 1. set the deploying address as the owner of the contract
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
/// @title Simple DAO smart contract.
contract simpleDAO {
// This simple DAO smart contract sends ether to the predefined address only if
// the majority of the members agree to send ether to the predefined address.
// If the majority decides not to send ether, the members who deposited ether
// are able to withdraw the ether they deposited.
function vote(uint proposal) public {
Voter storage sender = voters[msg.sender];
require(sender.weight != 0, "Has no right to vote");
require(!sender.voted, "Already voted.");
sender.voted = true;
sender.vote = proposal;
proposals[proposal].voteCount += sender.weight;
}
// winningProposal must be executed before EndVote
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";
contract newNFT is NFTokenMetadata, Ownable {
constructor() {
nftName = "artwork NFT";
@partylikeits1983
partylikeits1983 / gist:4f894198277fe62ea3fc4c034f0359ff
Created November 8, 2021 21:37
resize desktop on external monitor linux
#!/bin/bash
xrandr --output DP-1 --scale 1.5x1.5
pragma solidity >=0.7.0 <0.9.0;
contract natural_log {
function log2(uint x) public pure returns (uint){
uint y;
assembly {
let arg := x
x := sub(x,1)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract DefintionHackathonPrizeMoney {
//@dev address Owner => address token => uint balance of token
mapping(address => mapping (address => uint)) public prizeMoney;
@partylikeits1983
partylikeits1983 / pi.py
Created April 20, 2022 21:05
calculatingPi
def GLSpi(x):
odd = []
pi_div_4 = []
for i in range(x):
if i % 2 == 1:
odd.append(i)
for i in range(len(odd)):
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract Token is ERC20 {
uint constant _initial_supply = 100 * 1e18 * 1e6; // 100 million
@partylikeits1983
partylikeits1983 / DelegatedSignature
Created December 3, 2023 09:49
DelegatedSignature.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract DelegatedSignature {
// gameAddress => uint16 moves
mapping(address => uint16[]) public userData; // on chain data