Skip to content

Instantly share code, notes, and snippets.

@christophhalbi
christophhalbi / abort.py
Created April 3, 2025 10:49
Abort DocumentConverter.convert
with concurrent.futures.ThreadPoolExecutor() as executor:
future = executor.submit(document_converter.convert, file_path)
while not future.done():
yield False, []
if await abort_check():
future.cancel() # TODO: downside is that document_converter.convert still runs after that and eats cpu
break
import { PdfHighlighter } from 'react-pdf-highlighter';
/* eslint-disable @typescript-eslint/no-explicit-any */
type CustomHighlight = any;
class CustomPdfHighlighter extends PdfHighlighter<CustomHighlight> {
constructor(props: React.ComponentProps<typeof PdfHighlighter>) {
super(props);
}
@christophhalbi
christophhalbi / post.pl
Created March 16, 2023 12:39
Post image to instagram via Graph API
use Data::Printer;
use Facebook::OpenGraph;
my $facebook = Facebook::OpenGraph->new({
app_id => $app_id,
secret => $app_secret,
access_token => $params{access_token},
version => 'v3.3',
ua => Furl::HTTP->new(
capture_request => 1,