This file contains hidden or 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 PySide2 import QtWidgets, QtGui, QtCore | |
| def snap_value(value, snap_points, snap_threshold, verbose=False): | |
| """ | |
| Given a value and a list of "snapping points" it can snap to, | |
| snap it to the closest value if it's within the snapping threshold. | |
| """ | |
| if not snap_points: return value |
This file contains hidden or 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
| #include "Python.h" | |
| #include "pyerrors.h" | |
| #include <stdarg.h> | |
| #include <stdbool.h> | |
| typedef int (*awaitcallback)(PyObject *, PyObject *); | |
| typedef int (*awaitcallback_err)(PyObject *, PyObject *); | |
| typedef struct _PyAwaitableObject PyAwaitableObject; |
This file contains hidden or 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 typing import AsyncIterator | |
| import pyarrow as pa | |
| class AsyncMessageReader(AsyncIterator[pa.Message]): | |
| """Wraps an async iterable of bytes into an async iterable of PyArrow IPC messages. | |
| From this it is possible to build an AsyncRecordBatchStreamReader. | |
| """ |
This file contains hidden or 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
| max_days = {} | |
| for d in list2: # or list1, works the same | |
| day, month = int(d[:2]), d[2:] | |
| if month not in max_days or day > max_days[month]: | |
| max_days[month] = day | |
| result = [f"{value:02}{key}" for key,value in max_days.items()] | |
| print(f">>> {result}") |
This file contains hidden or 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 requests | |
| from io import BytesIO | |
| from http import HTTPMethod | |
| from json import JSONDecoder | |
| from requests import Timeout | |
| from requests import HTTPError | |
| from requests import ConnectionError | |
| from requests import JSONDecodeError | |
| from requests import RequestException | |
| from requests import TooManyRedirects |
1 hash function is random for non non-primitive objects, and it's seed is reset each time the interpreter is ran
Example:
python -c "print(hash('hello world'))" generates random numbers,
while python -c "print(hash(4.2))" always returns a constant value
This code will run forever ( and eat all your RAM ):
This file contains hidden or 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 os | |
| import sys | |
| import random | |
| from time import sleep | |
| try: | |
| from playwright_recaptcha import recaptchav2 | |
| from playwright.sync_api import Playwright, sync_playwright, expect | |
| except (ImportError, ModuleNotFoundError): | |
| os.system( |
This file contains hidden or 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
| #include <math.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| double Normal(double); | |
| double N(double, double, double, double, double); | |
| double delta(double, double, double, double, double); | |
| double delta2(double, double, double); | |
| double ND2(double, double, double); |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """ | |
| :description: Example Codes To Use The Python Class Which Calculate Options IV and Greeks | |
| :license: MIT. | |
| :author: Shabbir Hasan | |
| :created: On Thursday December 22, 2022 23:43:57 GMT+05:30 | |
| """ | |
| __author__ = "Shabbir Hasan aka DruneMoone" | |
| __webpage__ = "https://github.com/ShabbirHasan1" | |
| __license__ = "MIT" |
NewerOlder