This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from web3 import Web3 | |
from web3.types import BlockData | |
import logging | |
logger = logging.getLogger(__name__) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Check for inconsistencies in logs returned by eth_getLogs and eth_getTransactionReceipt | |
- Check that the `data` field is the same for logs with same transactionHash and logIndex, | |
between JSONRPC responses from eth_getLogs and eth_getTransactionReceipt | |
- Check that the logs from eth_getLogs are also found from eth_getTransactionReceipt | |
- Check that the logs from eth_getTransactionReceipt are also found from eth_getLogs | |
- Check that logs from eth_getLogs are not from failed transactions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyperf | |
import time | |
from concurrent.futures import ThreadPoolExecutor | |
from django.utils.functional import cached_property as dj_cached_property | |
from functools import cached_property as py_cached_property | |
# Most web requests have some IO, like database access. Simulate with sleeping | |
SLEEP_TIME = 0.01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo(): | |
x = 42 | |
def f(): | |
return x | |
return f | |
f = foo() | |
f() # 42 | |
def replace_closure_variables(func, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Turn input into something that's easy to paste to telegram/slack/other channels | |
as a code block | |
Usage: | |
$ cat foo | codify.py | xclip -selection clipboard | |
Vim shortcut to copy visual selection on <leader>c (add to .vimrc): | |
vmap <leader>c :w !cat \| codify.py \| xclip -selection clipboard<cr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Paste this in JS console or create a bookmarklet to find which elements cause a horizontal scroll on the page. | |
Correctly detects even elements that are hidden by css tricks (e.g. clip property). | |
Requires jQuery but could probably be optimized to work without it with modest effort. | |
*/ | |
(function() { | |
var mainSelector = prompt( | |
'Selector under which to search', | |
'body' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNextAvailableTabIndex() { | |
var tabIndexes = $('[tabIndex]').map(function() { | |
return parseInt($(this).attr('tabindex'), 10); | |
}).toArray(); | |
tabIndexes.push(0); // account for [] and [-1] | |
return Math.max.apply(null, tabIndexes) + 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 2; | |
if(x % 2 == 0): { | |
print("x is even") | |
} | |
else: { | |
print("x is odd") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am koirikivi on github. | |
* I am koirikivi (https://keybase.io/koirikivi) on keybase. | |
* I have a public key ASCccGJ9jSXEti0O44INgzyD4PfHpPEOBkvJOXRIc5hmuwo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int test = 1; | |
if (test == 1) | |
{ | |
printf("Test passed!\n"); | |
} | |
else; |
NewerOlder