Skip to content

Instantly share code, notes, and snippets.

@clar
clar / prob.py
Last active November 18, 2022 07:59
prob.py
import math
from re import S
def choose(n, k):
return math.factorial(n) // math.factorial(k) // math.factorial(n-k)
def prob(n, k, p):
return math.exp(math.log(p) * k + math.log(1-p) * (n-k) + math.log(choose(n, k)))
def probge(n, k, p):

Keybase proof

I hereby claim:

  • I am clar on github.
  • I am afu2019 (https://keybase.io/afu2019) on keybase.
  • I have a public key whose fingerprint is B291 B972 E732 04B8 0606 2533 3706 7E50 8FA0 2C3F

To claim this, I am signing this object:

afu2022

Keybase proof

I hereby claim:

  • I am clar on github.
  • I am afu2022 (https://keybase.io/afu2022) on keybase.
  • I have a public key ASCfzVIT_H7knoAyrjh7g4cL__zOpfTFNuiHX-IS4J_tugo

To claim this, I am signing this object:

@clar
clar / .deps...github...OpenZeppelin...openzeppelin-contracts...contracts...token...ERC20...ERC20.sol
Created September 5, 2021 14:41
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=true&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
@clar
clar / install-thrift-0.11.0-with-brew.sh
Created June 5, 2021 05:14 — forked from tonydeng/install-thrift-0.11.0-with-brew.sh
Install Thrift 0.11.0 with brew on macOS
#!/bin/bash
brew unlink thrift
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/4ba654c6d99b3b6804dd3843546a9dcbb700188b/Formula/thrift.rb
@clar
clar / wal.sol
Created September 30, 2020 07:37
mintable wal.sol
/**
*Submitted for verification at Etherscan.io on 2020-09-28
*/
/**
*Submitted for verification at Etherscan.io on 2019-08-02
*/
// File: contracts\open-zeppelin-contracts\token\ERC20\IERC20.sol
@clar
clar / ERC20StandardToken.sol
Last active September 7, 2020 09:06
ERC20StandardToken
/**
*Submitted for verification at Etherscan.io on 2020-03-14
*/
pragma solidity ^0.4.24;
//ERC20
contract ERC20Ownable {
address public owner;
constructor() public{
@clar
clar / transferLogicEnteredData.decode.go
Created July 6, 2020 09:19
decode transferLogicEntered data
type transferLogicEnteredData struct {
Data []byte
}
transferLogicABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"getKeyNonce\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"accountStorage\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_accountStorage\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"TransferLogicInitialised\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":true,\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"TransferLogicEntered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"index
/**
*Submitted for verification at Etherscan.io on 2020-07-01
*/
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
const assert = require('assert');
const leftPad = require('left-pad');
const truffleAssert = require('truffle-assertions');
const AccountStorage = artifacts.require("AccountStorage");
const LogicManager = artifacts.require("LogicManager");
const TransferLogic = artifacts.require("TransferLogic");
const BaseAccount = artifacts.require("Account");
const MyToken = artifacts.require("MyToken");
const MyNft = artifacts.require("MyNft");