Skip to content

Instantly share code, notes, and snippets.

View darrendbutler's full-sized avatar
🥲
Laughing to keep from crying

Darren Butler darrendbutler

🥲
Laughing to keep from crying
View GitHub Profile
@darrendbutler
darrendbutler / conda_tips.md
Last active September 14, 2024 13:43
conda tips

Conda Tips

Creating Environments

You can use --prefix instead of --name to put the environment in a specific directory.

Exporting Environments

conda env export --from-history > environment.yml

@darrendbutler
darrendbutler / SimpleCounter.sol
Created May 13, 2019 04:01
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity 0.5.1; //specifies version of solidity
contract SimpleCounter {//Doesn't have to match file name
int counter;// State variable gets stored in a node in Blockchain
//or: int public counter;
//public here automatically creates a getter function like the function below
//initialize variable with constructor
constructor() public{//Public means anyone can invoke this contract
counter = 0;
}
@darrendbutler
darrendbutler / main.cpp
Created February 5, 2019 15:50
party created by dbutler242 - https://repl.it/@dbutler242/party
//Darren Butler
//Program will: tell you how many people are attending
//
const int MAX_INVITES = 25;
#include <iostream>
#include <string>
#include <vector>
@darrendbutler
darrendbutler / CrowdSale.sol
Created November 14, 2018 20:45
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.24;
//CrowdSale contract knows the function signatures of IERC20
// because it is imported here
//Call functions from IERC20 like token.transfer(...).
import "./IERC20.sol";
import "./SafeMath.sol";
//The crowd sale contract allows a user to send ether directly to the
//contract's address and receive tokens in return.
@darrendbutler
darrendbutler / Election.sol
Created November 14, 2018 03:48
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
/*
Election contract that allows the owner to issue voting rights
to anybody and also end the election and announce results
*/
contract Election {
address public owner;
string public name;
@darrendbutler
darrendbutler / BaseAuction.sol
Created November 14, 2018 01:59
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
//This is an abstract base class because it is not implemented
// BaseAuction.sol
pragma solidity ^0.4.25;
contract BaseAuction {
address public owner;
modifier ownerOnly() {
require(msg.sender == owner);
@darrendbutler
darrendbutler / ballot.sol
Created November 13, 2018 02:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.25;
contract Escrow {
enum State {AWAITING_PAYMENT, AWAITING_DELIVERY, COMPLETE, REFUNDED}
State public currentState;
modifier buyerOnly() { require(msg.sender == buyer || msg.sender == arbiter); _; }
modifier sellerOnly() { require(msg.sender == seller || msg.sender == arbiter); _; }
modifier inState(State expectedState) { require(currentState == expectedState); _; }
@darrendbutler
darrendbutler / index.html
Created November 5, 2018 23:24
EthereumBlockTable created by dbutler242 - https://repl.it/@dbutler242/EthereumBlockTable
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Block Explorer</title>
</head>
<body>
<!-- The table is given the id "blocks" so it can be refernced when the content is updated-->
@darrendbutler
darrendbutler / index.html
Created November 5, 2018 23:23
EthereumBlockTable created by dbutler242 - https://repl.it/@dbutler242/EthereumBlockTable
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Block Explorer</title>
</head>
<body>
<!-- The table is given the id "blocks" so it can be refernced when the content is updated-->