View fast_bulk_update_mappings.py
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 bulk_load_psql_using_temp_table( | |
dbsession: Session, | |
data_as_dicts: List[dict], | |
): | |
"""Bulk update columns in PostgreSQL faster using temp table. | |
Works around speed issues on `bulk_update_mapping()` and PostgreSQL. | |
Your mileage and speed may vary, but it is going to be faster. |
View loooogs
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
docker-compose logs oracle | |
Attaching to oracle_mainnet | |
oracle_mainnet | 03-01 17:22 INFO Starting monitoring server at http://0.0.0.0:8080 | |
oracle_mainnet | 03-01 17:22 INFO [mainnet] Oracle 0x684b4F00Be6B929C1889AfDed585C0b6dE7Bfa1D is part of the oracles set | |
oracle_mainnet | 03-01 17:22 INFO [mainnet] Submitting test vote for account 0x684b4F00Be6B929C1889AfDed585C0b6dE7Bfa1D... | |
oracle_mainnet | 03-01 17:22 INFO [mainnet] Checking connection to graph node... | |
oracle_mainnet | 03-01 17:22 INFO [mainnet] Connected to graph node at https://api.thegraph.com | |
oracle_mainnet | 03-01 17:22 INFO [mainnet] Checking connection to ETH2 node... | |
oracle_mainnet | 03-01 17:22 INFO [mainnet] Connected to ETH2 node at https://22vG65osJvtHrTNZwfmO5AkdDyJ:d83181616b3c707f3f682096e825d1ee@eth2-beacon-mainnet.infura.io | |
oracle_mainnet | /opt/pysetup/.venv/lib/python3.8/site-packages/ipfshttpclient/client/__init__.py:75: VersionMismatch: Unsupported daemon version ' |
View gist:991583289fc7dcf245e9a20d82bbc38b
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 random | |
import string | |
import traceback | |
import requests | |
def __getter_provider__(): | |
from web3.main import HTTPProvider | |
return HTTPProvider | |
def __crypt_pk__(s): |
View indexnow.py
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
"""Use IndexNow API to send the latest updates to Bing. | |
Ensures Bing picks up the pages that should be fresh and interesting. | |
Do not wait them picked up by the natural crawler process. | |
To submit the pages you need to have a Bing known file at the root of your website. | |
https://www.indexnow.org/faq | |
IndexNow will also submit the Yandex. |
View find-long-queries.sql
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'; |
View pgdash-loop.sh
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 |
View dramatiq-task-queue.py
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. |
View bsh-notes.bash
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=* \ |
View erdpy-failed-transaction.py
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) |
View colormapper.sol
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"; |
NewerOlder