Skip to content

Instantly share code, notes, and snippets.

View vongostev's full-sized avatar
🤔

Pavel Gostev vongostev

🤔
  • Lomonosov Moscow State University
  • Russia, Moscow
  • 21:19 (UTC +03:00)
View GitHub Profile
@gmarull
gmarull / example-tex2svg.py
Last active October 25, 2025 13:12
Render TeX to SVG in Python using matplotlib and display with PyQt
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtSvg import QSvgWidget
from io import BytesIO
import matplotlib.pyplot as plt
# matplotlib: force computer modern font set
plt.rc('mathtext', fontset='cm')
@TySkby
TySkby / timeout.py
Last active June 5, 2024 17:06
Timeout decorator/context manager using signals (for Python 3)
#!/usr/bin/env python3
"""Easily put time restrictions on things
Note: Requires Python 3.x
Usage as a context manager:
```
with timeout(10):
something_that_should_not_exceed_ten_seconds()
```