Skip to content

Instantly share code, notes, and snippets.

View bswck's full-sized avatar
😳

Bartosz Sławecki bswck

😳
View GitHub Profile
@bswck
bswck / english_is_beautiful.md
Last active March 27, 2024 20:48
Words and phrases I learned from jaraco
@bswck
bswck / jaraco_namespace.py
Last active February 6, 2024 18:58
jaraco.* projects
#!/usr/bin/env -S pip-run -v httpx tabulate pyarrow pandas pypistats
from __future__ import annotations
import re
import xmlrpc.client
from functools import cache
import pandas as pd
from httpx import HTTPStatusError, get
from pypistats import recent
@bswck
bswck / projects.txt
Last active February 2, 2024 13:28
jaraco.develop testing
/jaraco/jaraco.functools [fork] (python, stdlib, functools)
/pypa/setuptools [fork] (python, python packaging, packaging, setuptools)
mempip (python, pip, caching)
@bswck
bswck / terms.txt
Created December 18, 2023 14:28
Polish math terms
abak
abakus
aksjomat
aksjomat Euklidesa
aksjomaty planimetrii
aksjomatyczna teoria mnogości
alef zero
alternatywa
analiza matematyczna
arcus cosinus
from __future__ import annotations
import re
import xmlrpc.client
from functools import cache
from posixpath import basename
import pandas as pd
from httpx import HTTPStatusError, get
from pypistats import recent
@bswck
bswck / descriptor_source_check.py
Last active September 17, 2023 16:47
Check whether the descriptor was called from the owner's method or from somewhere else.
# (C) 2023, bswck
import inspect
from collections.abc import Callable
from types import MethodType
class Descriptor:
def __init__(
self,
stack_offset: int = 1,
@bswck
bswck / xss.jpg
Last active January 22, 2023 14:36
xss.svg
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
<rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
<script type="text/javascript">
alert("XSS");
</script>
</svg>
@bswck
bswck / emailing.py
Last active November 11, 2022 20:21
Minimal, persistent and multi-threaded e-mail delivery system in Flask
"""
Remember to set the SMTP_HOST environment variable
or pass it as a keyword argument to EmailWorker()!
Requirements:
pip install flask-mail persist-queue
Usage:
# To deliver an e-mail
from flask_mail import Message
import functools
from reprlib import recursive_repr
from typing import Iterable
class TreeOverflow(OverflowError, ValueError):
pass
def _solve_args(**kwds):
@bswck
bswck / encoding.py
Created August 11, 2021 11:04
non-ASCII ASCII
b'\xbfa\xbf\xf3\xb3\xe6 g\xea\x9cl\xb9 ja\x9f\xf1' # -> żażółć gęślą jaźń
# TODO: figure out what the heck is the encoding