Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lyhistory on github.
  • I am lyhistory (https://keybase.io/lyhistory) on keybase.
  • I have a public key ASBW8uNyj49FcUst5BGBuEU_YtNN9CWCRL9xGN4K5QB3uwo

To claim this, I am signing this object:

{"sig":"9fe88eb5c6d6a6ee7f96c6ce43d767fa092e25301472b8eb99c01b2a61da8b888f66adbfa87c09e8fb367fd2f30a70574365464d9f87dab540c756d242b818041","msghash":"cc5e83c932f3ce17f6580f4dda1b0443cfd03189d0ba1d0d5bd7d5a1a3f36b7a"}
{"sig":"9fe88eb5c6d6a6ee7f96c6ce43d767fa092e25301472b8eb99c01b2a61da8b888f66adbfa87c09e8fb367fd2f30a70574365464d9f87dab540c756d242b818041","msghash":"cc5e83c932f3ce17f6580f4dda1b0443cfd03189d0ba1d0d5bd7d5a1a3f36b7a"}
@lyhistory
lyhistory / ca.md
Created October 18, 2018 04:45 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@lyhistory
lyhistory / ballot.sol
Created December 20, 2018 07: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=false&gist=
pragma solidity ^0.4.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {
@lyhistory
lyhistory / coin_caller.sol
Created December 20, 2018 08:43
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.0+commit.1d4f565a.js&optimize=false&gist=
pragma solidity ^0.5.0;
contract metaCoin {
mapping (address => uint) public balances;
constructor() public{
balances[msg.sender] = 10000;
}
function balancesOf(address addr) public returns(uint){
return balances[addr];
}
@lyhistory
lyhistory / test_call_delegatecall.sol
Created December 20, 2018 09:40
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.17+commit.bdeb9e52.js&optimize=false&gist=
pragma solidity ^0.4.17;
library SomeLib {
event calledSomeLib(address _from);
function calledSomeLibFun() public{
calledSomeLib(address(this));
}
}
contract SomeContract{
event callMeMaybeEvent(address _from);
import csv
f1 = file('1.csv', 'r')
f2 = file('2.csv', 'r')
f3 = file('results.csv', 'w')
c1 = csv.reader(open("1.csv", 'rU'), dialect='excel')
c2 = csv.reader(open("2.csv", 'rU'), dialect='excel')
c3 = csv.writer(f3)
@lyhistory
lyhistory / test_external_function.sol
Created December 28, 2018 03:25
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.17+commit.bdeb9e52.js&optimize=false&gist=
pragma solidity >=0.4.16 <0.6.0;
contract Oracle{
struct Request{
bytes data;
function(uint) external callback;
}
Request[] requests;
event NewRequest(uint);
event Reply(uint);
@lyhistory
lyhistory / test_assignment.sol
Created January 29, 2019 08:10
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.17+commit.bdeb9e52.js&optimize=false&gist=
pragma solidity >=0.4.0 <0.6.0;
contract C {
uint[] x;
// the data location of x is storage
// the data location of memoryArray is memory
function f(uint[] memory memoryArray) public{
x = memoryArray; // works, copies the whole array to storage
uint[] storage y = x; // works, assigns a pointer, data location of y is storage
//y[7]; // fine, returns the 8th element
//y.length = 2; // fine, modifies x through y