Skip to content

Instantly share code, notes, and snippets.

@mrcoet
mrcoet / pcsbuy.js
Created September 13, 2021 19:39 — forked from adityawarmanfw/pcsbuy.js
PancakeSwap SwapExactETHForTokens
const ethers = require('ethers');
const prompt = require('prompt-sync')({sigint: true});
const addresses = {
WBNB: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
router: "0x10ed43c718714eb63d5aa57b78b54704e256024e",
target: "0x8129686c77E63C22bE6a7F06F9C61f135BD0a0CF" // Change this to your address ELSE YOU GONNA SEND YOUR BEANS TO ME
}
const BNBAmount = ethers.utils.parseEther('0.1').toHexString();
@mrcoet
mrcoet / web3py_aio.py
Created August 14, 2021 23:48 — forked from miracle2k/web3py_aio.py
Using web3py with asyncio
"""
Inspired by this approach:
- https://twitter.com/zzzeek/status/1279069782533386247
- https://gist.github.com/zzzeek/2a8d94b03e46b8676a063a32f78140f1
- https://gist.github.com/zzzeek/33943060f7a08cf9e82bf8df1f0f75de, https://gist.github.com/zzzeek/4e89ce6226826e7a8df13e1b573ad354#file-asyncio_plus_greenlet-py-L28
Essentially we use greenlets to make the IO layer async and the top layer uses async/await, but everything in
between can be regular sync code.
@mrcoet
mrcoet / Verificator.sol
Created June 19, 2021 01:05 — forked from ageyev/Verificator.sol
Smart contract for Ethereum's account owner verification using Cryptonomica.net notary verified OpenPGP public key
/*
Usage:
1. Account owner sends a request for verification, in this request he sends a fingerprint of his OpenPGP key stored on cryptonomica.net
2. This contracts sends back a string to sign
3. Accont owener signs this strign with his OpenPGP key and sends back to smartcontract.
4. Information about verification is public visible - who needs to check can download verified public key from cryptonomica.net and check if owner of stated Ehereum acconts is also known owner of verified OpenPGP key on cryptonomica.net
It's also possible to create a web-inerface using Cryptonomica's API like:
@mrcoet
mrcoet / ProofOfExistence.sol
Created June 19, 2021 01:00 — forked from ageyev/ProofOfExistence.sol
This smartcontract is used to store documents text on the Ethereum blockchain and to get the document by document's hash (sha256).
/*
This smartcontract is used to store documents text on the Ethereum blockchain
and to get the document by document's hash (sha256).
*/
contract ProofOfExistence{
/* ---- Public variables: */
string public created;
pragma solidity ^0.4.15;
contract StringsAndBytes {
/* --- public variables for storing tests results */
string public lastTestStringResult; //
bytes32 public lastTestBytes32Result; //
bytes public lastTestBytesResult; // bytes: dynamically-sized byte array
bool public lastTestBoolResult; //
'''
╋╋╋╋╋╋╋╋╋╋╋╋┏┓
╋╋╋╋╋╋╋╋╋╋╋┏┛┗┓
┏━━┳┓┏┳━━┳━╋┓┏┛
┃┏┓┃┃┃┃┏┓┃┏┓┫┃
┃┗┛┃┗┛┃┏┓┃┃┃┃┗┓
┗━┓┣━━┻┛┗┻┛┗┻━┛
╋╋┃┃
β•‹β•‹β”—β”› πŸ†‚πŸ…ΎπŸ†„πŸ†πŸ…²πŸ…΄ (https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/what-is-modular-arithmetic)
@mrcoet
mrcoet / NewlyCreatedTokenQuery.ql
Created May 9, 2021 01:43 — forked from buddies2705/NewlyCreatedTokenQuery.ql
GraphQL API to get the newly created Ethereum Tokens
{
ethereum {
smartContractCalls(options: {desc: "block.height", limit: 10}, smartContractMethod: {is: "Contract Creation"}, smartContractType: {is: Token}) {
block {
height
timestamp {
time
}
}
smartContract {
from datetime import datetime, timedelta
def time_now_iso8601() -> str:
time_now = datetime.utcnow().replace(microsecond=0).isoformat()
return str(time_now + 'Z')
def add_n_minutes(num: int) -> str:
time_now = datetime.utcnow()
@mrcoet
mrcoet / num_format.py
Created April 28, 2021 01:33
Python format number with commas
# Trying to reproduce the fromat function
# numbers = "{:,}".format(5000000) => 5,000,000
def makeComma(num, js=''):
if len(str(num)) >= 4:
js = "," + str(num)[-3:] + js
num = str(num)[:-3]
return makeComma(int(num), js)
else:
return f'{str(num)}{str(js)}'
@mrcoet
mrcoet / gist:f74237efb81e58f68ec66130fed6ac43
Created April 18, 2021 05:42 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue: