Skip to content

Instantly share code, notes, and snippets.

View LefterisJP's full-sized avatar

Lefteris Karapetsas LefterisJP

View GitHub Profile
@LefterisJP
LefterisJP / nolambda.py
Last active January 27, 2024 16:03
Make else case work without def or lambda
import operator
if input('Enter 1 for simple case:') == '1':
data = {'a': 1, 'b': 2}
value_getter = operator.getitem
else:
data = {'a': {'innerkey': 1}, 'b': {'innerkey': 2}}
value_getter = lambda x, y: x[y]['innerkey']
print(value_getter(data, 'a'))
@LefterisJP
LefterisJP / raiden-lef-matrix.log
Created July 20, 2018 22:54
raiden-lef-matrix.log
Welcome to Raiden, version 0.3.1.dev967+g6444580a!
----------------------------------------------------------------------
| This is an Alpha version of experimental open source software |
| released under the MIT license and may contain errors and/or bugs. |
| Use of the software is at your own risk and discretion. No |
| guarantee whatsoever is made regarding its suitability for your |
| intended purposes and its compliance with applicable law and |
| regulations. It is up to the user to determine the software´s |
| quality and suitability and whether its use is compliant with its |
@LefterisJP
LefterisJP / uniswap.csv
Created December 29, 2020 21:23
uniswap.csv
We can't make this file beautiful and searchable because it's too large.
address,uni,is_lp,is_user,is_socks
0x0000000000000000000000000000000000000000,400,True,True,False
0x0000000000000000000000000000000000000001,5988.626491,True,True,False
0x0000000000000000000000000000000000001337,400.010855,True,True,False
0x000000000000000000000000000000000000dEaD,49560.985333,True,True,False
0x000000000000006F6502B7F2bbaC8C30A3f67E9a,400,False,True,False
0x0000000000000D9054F605cA65A2647c2B521422,487.471197,True,True,False
0x0000000000001DD36b0C6318894ac98751A8768E,400,False,True,False
0x00000000000043DC09b2d31827CB23F414E1Fa3D,400,False,True,False
0x00000000000080C886232E9b7EBBFb942B5987AA,1133.399093,True,True,False
@LefterisJP
LefterisJP / it_works.py
Created June 12, 2022 17:47
this type checks!! yay
import random
from functools import wraps
from typing import TYPE_CHECKING, Any, Callable, Dict, Protocol, Union, overload
from typing_extensions import Concatenate, ParamSpec
P = ParamSpec('P')
class MaybeInjectedInt(Protocol[P]):
@LefterisJP
LefterisJP / test.py
Last active June 12, 2022 15:18
how_to_type_this
import random
from functools import wraps
from typing import TYPE_CHECKING, Any, Callable, Union
from typing_extensions import Concatenate, ParamSpec
P = ParamSpec('P')
def maybe_inject_int(method: Callable[Concatenate['DBHandler', int, P], Any]) -> Union[
@LefterisJP
LefterisJP / clr_hashes
Last active September 3, 2021 12:40
clr_hashes
2ffd9be4 2ca841e9 b4cd8074 8feacdd4 56b0464f 3a253df3 371ab487 61eea1d0 cb2551e9 68bbf1d6 f04acfbb e0d33f21 7a5cdc0c 43b0bbc4 423fbb56 1c26d43a
526eaee2 21802c06 c223094e fbd9138d 4ea2b1ee 1a94a0da c7cfeb19 d7a2abb8 4daaa639 eb02a5a7 6df28b1c dd03a0a0 07550418 4a665aca 85e25206 256f4cf8
@LefterisJP
LefterisJP / ClosedTradesVue.diff
Last active August 27, 2021 22:08
ClosedTrades.vue diff
diff --cc frontend/app/src/components/history/ClosedTrades.vue
index b25659f9e,bcea69624..000000000
--- a/frontend/app/src/components/history/ClosedTrades.vue
+++ b/frontend/app/src/components/history/ClosedTrades.vue
@@@ -19,121 -19,195 +19,312 @@@
:tooltip="$t('closed_trades.refresh_tooltip')"
@refresh="refresh"
/>
+ {{ $t('closed_trades.title') }}
+ </template>
@LefterisJP
LefterisJP / asd
Created June 11, 2021 16:18
dsad
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreifkyvhqhhmphgb37ycdfs3nm7jgv27djodkobv76upj6vvoizcez4 ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
{
"0x00057ef157D01c28da3e545487A4D93f55b70842": [
661
],
"0x0007C95c1d788b80d85E8E5138d1c9031D6FfD69": [
661
],
"0x0007a75d9fd37A8d341465E50ED7C0874Eb16076": [
661
],
@LefterisJP
LefterisJP / test_cdp_calculations.py
Created May 28, 2021 09:09
test_cdp_calculations.py
import argparse
from typing import NamedTuple
from rotkehlchen.constants.assets import A_ETH, A_USD
from rotkehlchen.externalapis.coingecko import Coingecko
from rotkehlchen.fval import FVal
class VaultType(NamedTuple):
name: str