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.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)
@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
// 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";
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.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.
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