Skip to content

Instantly share code, notes, and snippets.

'release_summary': 'The latest release of ReadOnlyRest (v1.62.0) addresses '
'critical security vulnerabilities, including '
'CVE-2024-53990, which fixes a high-risk authentication '
'flaw in the AsyncHttpClient library. Additionally, '
'this update introduces support for Elastic APM, '
'enabling real-time application performance monitoring, '
'and ensures compatibility with the latest '
'Elasticsearch and Kibana versions (8.17.1 and 8.16.3). '
'Sysadmins are strongly encouraged to update '
'immediately to mitigate security risks and leverage '
'release_summary': 'The ReadOnlyRest 1.53.0 release addresses two critical '
'security vulnerabilities: CVE-2023-4586, which could '
'allow MITM attacks due to missing hostname validation '
'in the Hot Rod client, and CVE-2023-5072, a '
'high-severity DoS vulnerability in JSON-Java. '
'Additionally, this release introduces support for the '
'latest Kibana and Elasticsearch versions (8.11.x and '
'7.17.16) and includes several bug fixes, such as '
'resolving login issues in Kibana when deployed using '
'ECK and improving stability during license service '
@ton77v
ton77v / langchain_load_qa_chain_bug2.py
Created September 16, 2023 08:54
MapRerankDocumentsChain issue: empty answers ranked 90-100
import os
import tempfile
from pathlib import Path
import pprint
import pdfkit # pip install pdfkit
from langchain.chat_models import ChatOpenAI
from langchain.document_loaders import PyPDFLoader
from langchain.schema import Document
@ton77v
ton77v / langchain_load_qa_chain_bug1.py
Created September 16, 2023 08:54
MapRerankDocumentsChain issue: UserWarning & ValueError
import os
import tempfile
from pathlib import Path
import pprint
import pdfkit # pip install pdfkit
from langchain.chat_models import ChatOpenAI
from langchain.document_loaders import PyPDFLoader
from langchain.schema import Document
@ton77v
ton77v / dicts_merge.py
Last active July 21, 2023 14:15
deep merge nested dictionaries in Python
"""
Deep merging two dictionaries with any level of nesting.
Based on solution found at https://stackoverflow.com/a/71024248/7521470
Fixed a bug + mutability issue
"""
import copy
from unittest import TestCase
import pprint
@ton77v
ton77v / gist:cd625ca0b8ee7b4bd3a67791a4fce903
Created June 30, 2023 17:40
shell commands to create/activate venv
# WINDOWS:
python -m venv venv_name
.\venv_name\Scripts\activate
# OS | LINUX:
python -m venv venv_name
source venv_name/bin/activate
# ...
pip install -r requirements.txt
@ton77v
ton77v / example.py
Created March 22, 2023 05:27
figuring out how to work with cryptofeed books
import asyncio
from cryptofeed import FeedHandler
from cryptofeed.defines import L2_BOOK
from cryptofeed.exchanges import Binance, Huobi
def add_feed_test():
# following example from https://github.com/bmoscon/cryptofeed/blob/master/examples/demo_loop.py
async def orderbook_watch(book, receipt_timestamp):
print(f'{receipt_timestamp}: {book.exchange} - {book.symbol}, {len(book.book)} entries')
@ton77v
ton77v / background.js
Last active August 25, 2020 10:00
example of Electron splash window @ load
'use strict'
import { app, BrowserWindow, protocol } from 'electron'
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
// --- CONTEXT MENU -----
const contextMenu = require('electron-context-menu')
contextMenu({
prepend: (defaultActions, params, browserWindow) => []