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
SELECT | |
application_name, | |
pid, | |
now() - pg_stat_activity.query_start AS duration, | |
query, | |
state | |
FROM pg_stat_activity | |
WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes'; |
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
#!/bin/bash | |
# | |
# Monitor loop for TimescaleDB using pgdash | |
# - TimescaleDB runs in a Docker, exposed over TCP/IP socket 127.0.0.1:5555 | |
# - pgdash SaaS offering used https://pgdash.io | |
# - run the sample collection loop every 30 seconds | |
# | |
# | |
set -e | |
set -x |
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 time | |
from typing import Dict, Optional | |
from dramatiq import Message, Broker | |
from dramatiq.results import ResultMissing | |
class TaskQueue: | |
"""A task queue using Dramatiq background task framework. |
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
./geth_linux \ | |
--config ./config.toml \ | |
--datadir ./data/bsc \ | |
--cache 8000 \ | |
--rpc.allow-unprotected-txs \ | |
--txlookuplimit 0 \ | |
--http.port 9545 \ | |
--http.addr 127.0.0.1 \ | |
--http.vhosts=* \ |
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 erdpy.accounts import Account, Address | |
from erdpy.proxy import ElrondProxy | |
from erdpy.transactions import BunchOfTransactions | |
from erdpy.transactions import Transaction | |
from erdpy.wallet import signing | |
proxy = ElrondProxy("https://devnet-gateway.elrond.com") | |
sender = Account(pem_file="test-wallet.pem") | |
sender.sync_nonce(proxy) |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.7; | |
pragma abicoder v2; | |
contract ArrayTest { | |
function colourToString(uint r, uint g, uint b) private pure returns(string memory) { | |
bytes memory alphabet = "0123456789abcdef"; |
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
"""Below is an example for faster JSON-RPC event fetcher. | |
It skips a lot of steps, like converting raw binary values to corresponding numbers (float, ints), | |
looking up ABI labels and building `AttributedDict` object. | |
The resulting Event dictitionary is generated faster, but harder to use and you need to know what you are doing. | |
""" | |
def _fetch_events_for_all_contracts( |
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
with pq.ParquetWriter( | |
fname, | |
Candle.to_pyarrow_schema(small_candles), | |
compression='snappy', | |
allow_truncated_timestamps=True, | |
version='2.0', # Highest available schema | |
data_page_version='2.0', # Highest available schema | |
) as writer: | |
def reset_data(): |
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
class EthereumAddress(types.TypeDecorator): | |
"""SQLAlchemy class to store Ethereum addresses as binary in SQL database. | |
Ethereum address is 160 bits, the last bytes of 256 bit public key of the address's signer. | |
Ethereum address checksum is encoded in the case of hex letters. | |
We skip any Ethereum address checksum checks, as they slow down large data processing too much. | |
Any returned address data will be in lowercase. | |
""" |
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 logging | |
import time | |
import timeit | |
from typing import Type | |
from sqlalchemy.orm import Session | |
from sqlalchemy.sql import text | |
from dex_ohlcv.db import get_real_database | |
from dex_ohlcv.models.uniswap import Base, UniswapLikeCandle, Pair |