Skip to content

Instantly share code, notes, and snippets.

@ostr00000
ostr00000 / point_to_line.py
Created January 24, 2022 14:26
2D version for finding the shortest distance between a point and line segments. Based on https://stackoverflow.com/a/51240898 and http://www.fundza.com/vectors/point2line/index.html.
import math
def dot(v, w):
x, y = v
X, Y = w
return x * X + y * Y
def length(v):
@ostr00000
ostr00000 / fetch_steam_comments.py
Last active July 25, 2021 22:53
Load all comments from steam workshop (useful to find text in comment).
import re
import sys
from dataclasses import dataclass
from datetime import datetime
from typing import Optional, Iterator, cast
import bs4
import requests
from bs4 import Tag
@ostr00000
ostr00000 / pyqt_icons.py
Created July 6, 2020 22:04
Simple program to display all icons available for pyqt
"""
Create widget with available icons from qt and based on freedesktop.org
https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
"""
from PyQt5.QtCore import QSize
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QGridLayout, QStyle, \
QFormLayout, QLabel, QScrollArea, QLineEdit, QTabWidget