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 / 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/
@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
@LefterisJP
LefterisJP / beaconchain_connection_error_in_the_ci.txt
Created May 22, 2021 09:25
beaconchain_connection_error_in_the_ci.txt
2021-05-22T00:06:09.0642770Z
2021-05-22T00:06:09.0643445Z =================================== FAILURES ===================================
2021-05-22T00:06:09.0644227Z _______________________ test_get_balance_history_single ________________________
2021-05-22T00:06:09.0644818Z
2021-05-22T00:06:09.0645985Z self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.0647570Z conn = <urllib3.connection.HTTPSConnection object at 0x7f8504a99850>
2021-05-22T00:06:09.0649442Z method = 'GET', url = '/api/v1/validator/9/balancehistory'
2021-05-22T00:06:09.0650482Z timeout = Timeout(connect=5, read=30, total=None), chunked = False
2021-05-22T00:06:09.0652153Z httplib_request_kw = {'body': None, 'headers': {'User-Agent': 'rotkehlchen', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}}
2021-05-22T00:06:09.0653509Z timeout_obj = Timeout(connect=5, read=30, total=None), read_timeout = 30
@LefterisJP
LefterisJP / macos-auto-update.log
Created March 19, 2021 20:34
macos-auto-update.log
John-Does-Air:~ johndoe$ /Applications/rotki.app/Contents/MacOS/rotki
(node:687) ProtocolDeprecateCallback: The callback argument of protocol module APIs is no longer needed.
Checking for update
2021-03-19T20:31:45.111Z: Exiting the application
2021-03-19T20:31:45.121Z: Determining if we are packaged by seeing if /Applications/rotki.app/Contents/Resources/rotkehlchen_py_dist/rotkehlchen exists
2021-03-19T20:31:45.125Z: Starting packaged python subprocess: /Applications/rotki.app/Contents/Resources/rotkehlchen_py_dist/rotkehlchen/rotkehlchen-1.15.0-macos --api-port 4242 --loglevel critical --api-cors app://* --logfile /Users/johndoe/Library/Application Support/rotki/logs/rotkehlchen.log
2021-03-19T20:31:45.148Z: The Python sub-process started on port: 4242 (PID: 695)
Found version 1.15.1 (url: rotki-darwin-v1.15.1.zip, rotki-darwin-v1.15.1.dmg)
Downloading update from rotki-darwin-v1.15.1.zip, rotki-darwin-v1.15.1.dmg
updater cache dir: /Users/johndoe/Library/Application Support/Caches/rotki-updater
{
"0x000001f568875F378Bf6d170B790967FE429C81A": [
232
],
"0x01199307A3FeB7474fbdeaA9f68d5C8b1aF85Ad3": [
232
],
"0x03653B34D2bD05D82c8Ae879d7096D02b94aA010": [
232
],