Skip to content

Instantly share code, notes, and snippets.

⚡️
Increasing potential

Gerald Nash aunyks

⚡️
Increasing potential
Block or report user

Report or block aunyks

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bin-stuffs.py
def to_bin(n):
return bin(n)[2:] if n >= 0 else bin(n)[3:]
def to_int(b):
return int(b, 2)
def ones_complement(b):
return b.replace('1', '2').replace('0', '1').replace('2', '0')
def twos_complement(b):
@aunyks
aunyks / utils.py
Last active May 2, 2018
Simple utility functions used throughout my research.
View utils.py
import datetime
import json
import requests
def unix_to_date(unix_int):
if type(unix_int) == type(''):
return datetime.datetime.fromtimestamp(int(unix_int)).strftime('%Y-%m-%d %H:%M:%S')
elif type(unix_int) == type(0):
return datetime.datetime.fromtimestamp(unix_int).strftime('%Y-%m-%d %H:%M:%S')
else:
@aunyks
aunyks / metamine.sol
Created Apr 30, 2018
A minable ERC20 token.
View metamine.sol
pragma solidity ^0.4.0;
// event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber);
// event Transfer(address indexed _from, address indexed _to, uint256 _value);
// event Approval(address indexed _owner, address indexed _spender, uint256 _value);
contract Metamine {
uint256 public constant MAX_TARGET = 2**256 - 1;
uint256 public constant totalSupply = 21000000; // max 21M tokens
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@aunyks
aunyks / erc721-example.sol
Last active Mar 7, 2019
My implementation of the ERC721 token standard. WARNING: THIS CODE IS FOR EDUCATIONAL PURPOSES. DO NOT DEPLOY TO THE NETWORK.
View erc721-example.sol
pragma solidity ^0.4.19;
contract ERC721 {
string constant private tokenName = "My ERC721 Token";
string constant private tokenSymbol = "MET";
uint256 constant private totalTokens = 1000000;
mapping(address => uint) private balances;
mapping(uint256 => address) private tokenOwners;
mapping(uint256 => bool) private tokenExists;
mapping(address => mapping (address => uint256)) private allowed;
mapping(address => mapping(uint256 => uint256)) private ownerTokens;
View erc721-definitions.sol
contract ERC721 {
// ERC20 compatible functions
function name() constant returns (string name);
function symbol() constant returns (string symbol);
function totalSupply() constant returns (uint256 totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
// Functions that define ownership
function ownerOf(uint256 _tokenId) constant returns (address owner);
function approve(address _to, uint256 _tokenId);
function takeOwnership(uint256 _tokenId);
@aunyks
aunyks / snipbin-contract-abi.json
Created Dec 15, 2017
The Application Binary Interface (ABI) for Snipbin's underlying smart contract. Contract address on ETH mainnet: 0x7dB065361C2956b9bC21d5199F7c7010e6Dc964D.
View snipbin-contract-abi.json
[
{
"constant": false,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "getSnippet",
@aunyks
aunyks / counter.sol
Last active Nov 29, 2018
A simple counter written in Solidity, for Ethereum.
View counter.sol
pragma solidity ^0.4.0;
contract Counter {
int private count = 0;
function incrementCounter() public {
count += 1;
}
function decrementCounter() public {
count -= 1;
}
function getCount() public constant returns (int) {
View my-erc20-token.sol
pragma solidity ^0.4.15;
contract MyERCToken {
// Create a table so that we can map addresses
// to the balances associated with them
mapping(address => uint256) balances;
// Create a table so that we can map
// the addresses of contract owners to
// those who are allowed to utilize the owner's contract
mapping(address => mapping (address => uint256)) allowed;
You can’t perform that action at this time.