Skip to content

Instantly share code, notes, and snippets.

View trilobiet's full-sized avatar

Riesgo Eléctrico trilobiet

View GitHub Profile
@trilobiet
trilobiet / binarypos.cpp
Last active November 4, 2024 07:43
Find the position of an integer value in a list of integers, or else find the position where it should be inserted while keeping the list ordered.
/* Binary Search Plugin
*
* Find the position of an integer value in a list of integers,
* or else find the position where it should be inserted while keeping the list ordered.
*
* Compiling and installation as a MySQL plugin:
*
* 1) g++ -shared -o binarypos.so binarypos.cpp
* 2) sudo service mysql stop
* 3) sudo cp ./binarypos.so /usr/lib/mysql/plugin/
@trilobiet
trilobiet / create_pdf_from_list_of_urls.py
Last active September 23, 2024 13:39
Load web pages from a list of urls and save as a single pdf file
'''
Read a list of urls, load the pages and save as a single pdf.
File urls.txt must be available alongside this script.
After running, resulting pdf is available as 'generated.pdf'
'''
from weasyprint import HTML
# cli: pip3 install weasyprint
from PyPDF2 import PdfMerger
# cli: pip3 install PyPDF2
from io import BytesIO