Skip to content

Instantly share code, notes, and snippets.

use std::thread;
use std::sync::mpsc;
fn main() {
let total = add(46, -4);
println!("total = {};", total)
}
fn add(n1: i32, n2: i32) -> i32 {
let mut sum = n1;
let (count, increment) = if n2 > 0 {(n2, 1)} else {(-n2, -1)};
use std::thread;
use std::sync::Arc;
use std::sync::Mutex;
struct Accumulator {
sum: i32,
operation_count: i32,
}
impl Accumulator {
use std::thread;
use std::sync::Arc;
use std::sync::atomic::AtomicI32;
use std::sync::atomic::Ordering;
fn main() {
let total = add(46, -4);
println!("total = {};", total)
}
fn add(n1: i32, n2: i32) -> i32 {
using NBitcoin;
using NBitcoin.Protocol;
public class LegacyPayToAddress
{
public static void Run()
{
//We will send the coins from this address mtdFu4Qb8why1t71zpUpKkXpsCfjbYbUKj to the one below and has the available output from
//the transaction with the hash 597ca9461b98b541f4d63e4679381947df7698c26750b1ad611bf08e947be2ac
Network network = Network.RegTest;
@nodlAndHodl
nodlAndHodl / contracts...Fundraiser.sol
Created February 21, 2022 22:27
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.26+commit.4563c3fc.js&optimize=false&runs=200&gist=
pragma solidity ^0.4.24;
contract Fundraiser {
mapping(address=>uint) balances;
// VULNERABLE
function withdrawCoins(){
uint withdrawAmount = balances[msg.sender];
Wallet wallet = Wallet(msg.sender);
wallet.payout.value(withdrawAmount)();
@nodlAndHodl
nodlAndHodl / contracts...LemonadeStand.sol
Created February 18, 2022 14:21
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.8.11+commit.d7f03943.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
contract LemonadeStand {
address owner;
uint skuCount;
enum State { ForSale , Sold, Shipped }
@nodlAndHodl
nodlAndHodl / contracts...Token.sol
Created February 5, 2022 20:54
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.8.11+commit.d7f03943.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract myToken {
string public constant name = "Tokenomics";
string public constant symbol = "TOK";
uint8 public constant decimals = 18; // 18 is the most common number of decimal places
uint _totalSupply;
@nodlAndHodl
nodlAndHodl / contracts...EventsContract.sol
Last active February 5, 2022 19:47
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract EventsContract {
// Represents the time when the bidding will end
uint biddingEnds = block.timestamp + 5 days;
struct HighestBidder {
address bidder;
string bidderName;
@nodlAndHodl
nodlAndHodl / contracts...Inheritance.sol
Created February 5, 2022 03:46
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract MainContract {
uint public value;
constructor (uint amount) {
value = amount;
}
@nodlAndHodl
nodlAndHodl / contracts...Modifiers2.sol
Created February 4, 2022 22:31
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract Modifiers2 {
uint public minimumOffer = 100;
modifier minimumAmount(){
//Could also use require( msg.value >= minimumOffer)
if(msg.value >= minimumOffer){
_;