Skip to content

Instantly share code, notes, and snippets.

View k06a's full-sized avatar
🚀
DeFi dreamer

Anton Bukov k06a

🚀
DeFi dreamer
View GitHub Profile
@k06a
k06a / ERC888
Last active July 8, 2018 18:40 — forked from troverman/ERC888
ERC888-imporvement
contract MultidimensionalToken {
string public name;
string public symbol;
mapping (uint256 => string) internal tokenNames;
mapping (uint256 => string) internal tokenSymbols;
mapping (uint256 => uint8) internal tokenDecimals;
mapping (uint256 => mapping (address => uint)) internal balances;
@k06a
k06a / MetaIterator.hpp
Last active May 24, 2018 14:31
Iterator over std::vector of containers (std::vector, std::list, std::deque)
#include <iostream>
#include <list>
#include <deque>
#include <vector>
// Can use mpark instead of std: https://github.com/mpark/variant
//#include "variant.hpp"
#include <variant>
//
@k06a
k06a / ERC1003.sol
Last active April 17, 2018 07:00
ERC1003 estimate gas cost
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
Verifying my Blockstack ID is secured with the address 19mtYjEqL9bXWsDBUgHtaLRneCiB4FWwma https://explorer.blockstack.org/address/19mtYjEqL9bXWsDBUgHtaLRneCiB4FWwma
@k06a
k06a / query.sh
Last active October 18, 2022 11:09
Passwords Query (+macOS-fix) (+sgrep)
#!/bin/bash
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3
# 1. Fixed letter1, letter2, letter3 assignments for macOS compatibility
# 2. Changed grep to sgrep (sorted grep), need to preinstall: npm i -g sgrep
if [ "$1" != "" ]; then
letter1=$(echo ${1:0:1})
if [[ $letter1 == [a-zA-Z0-9] ]]; then
@k06a
k06a / count-bits-set-256.sol
Created November 15, 2017 10:28
Count bits set 256
// https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
function countBits(uint256 v) public constant returns(uint256) {
v = v - ((v >> 1) & uint256(~uint256(0)/3));
v = (v & uint256(~uint256(0)/15*3)) + ((v >> 2) & uint256(~uint256(0)/15*3));
v = (v + (v >> 4)) & uint256(~uint256(0)/255*15);
return uint256(v * (uint256(~uint256(0)/255))) >> (32 - 1) * 8;
}
@k06a
k06a / arguments.js
Last active October 24, 2017 14:22
Constructor Arguments ABI-encoded
var abi = require('ethereumjs-abi');
var x = abi.simpleEncode("constructor(uint256,uint256,uint256,address,address,address,address)",
1508878283,
1519431362,
4700,
"0x0b8e27013dfA822bF1cc01b6Ae394B76DA230a03",
"0x5F85A0e9DD5Bd2F11a54b208427b286e9B0B519F",
"0x7F781d08FD165DBEE1D573Bdb79c43045442eac4",
"0x98bf67b6a03DA7AcF2Ee7348FdB3F9c96425a130");
@k06a
k06a / install-ffmpeg-with-h265.sh
Last active March 9, 2021 15:51
H265 with ffmpeg
# Installing ffmpeg with H265 support
brew tap varenc/ffmpeg
brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD
# Installing mp4edit tool
brew install bento4
@k06a
k06a / VanityPool.sol
Last active January 18, 2021 14:51
VanityPool
pragma solidity ^0.4.0;
contract VanityTask {
function lengthOfCommonPrefix(bytes a, bytes b) constant returns(uint) {
uint len = (a.length <= b.length) ? a.length : b.length;
for (uint i = 0; i < len; i++) {
if (a[i] != b[i]) {
return i;
}
@k06a
k06a / keybase.md
Last active June 7, 2017 10:13
keybase.md

Keybase proof

I hereby claim:

  • I am k06a on github.
  • I am k06a (https://keybase.io/k06a) on keybase.
  • I have a public key ASCluXHEStF-cY5wgzsAWQsU50gb7uxtC1fpJlQYS-22_Qo

To claim this, I am signing this object: