Skip to content

Instantly share code, notes, and snippets.

View DahlitzFlorian's full-sized avatar
🎯
Focused

Florian Dahlitz DahlitzFlorian

🎯
Focused
View GitHub Profile
@DahlitzFlorian
DahlitzFlorian / t.py
Created November 29, 2022 15:59
Provide the full working example for a user asking a question on the video "How to Capture What Is Written to stdout in Python"
import contextlib
import io
captured_output = io.StringIO()
with contextlib.redirect_stdout(captured_output):
help(pow)
captured_string = captured_output.getvalue()
print(captured_string.upper())
@DahlitzFlorian
DahlitzFlorian / pegasus_abs_summarizer.ipynb
Created July 28, 2020 20:12
Abstractive-based Text Summarization Using PEGASUS
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DahlitzFlorian
DahlitzFlorian / t5_abs_summarizer.ipynb
Last active July 27, 2020 08:52
Abstractive-based Text Summarization Using T5
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DahlitzFlorian
DahlitzFlorian / presumm_abs_summarizer.ipynb
Last active May 11, 2022 15:32
Abstractive-based Text Summarization Using PreSumm
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DahlitzFlorian
DahlitzFlorian / index.html
Created May 6, 2019 07:55
Pretty nice login page
<!DOCTYPE html>
<html lang="en">
<head>
<title>Pretty Nice Login Page</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<form class="box" action="index.html" method="post">
<h1>Login</h1>
@DahlitzFlorian
DahlitzFlorian / timeit_example.py
Created April 24, 2019 20:44
Article: How To Create Your Own Timing Context Manager
def test():
"""Stupid test function"""
L = [i for i in range(100)]
if __name__ == '__main__':
import timeit
print(timeit.timeit("test()", setup="from __main__ import test"))
@DahlitzFlorian
DahlitzFlorian / timing_generator.py
Last active April 23, 2019 19:38
Article: How To Create Your Own Timing Context Manager
from contextlib import contextmanager
from time import time
@contextmanager
def timing(description: str) -> None:
start = time()
yield
ellapsed_time = time() - start
@DahlitzFlorian
DahlitzFlorian / timer_class.py
Created April 23, 2019 19:36
Article: How To Create Your Own Timing Context Manager
from time import time
class Timer(object):
def __init__(self, description):
self.description = description
def __enter__(self):
self.start = time()
def __exit__(self, type, value, traceback):
self.end = time()
@DahlitzFlorian
DahlitzFlorian / main.py
Last active April 8, 2019 07:51
list.sort() vs. sorted(list) article - Speed
import random
from boxx import timeit
def list_sort(arr):
return arr.sort()
def sorted_builtin(arr):
@DahlitzFlorian
DahlitzFlorian / main.py
Last active April 8, 2019 07:50
list.sort() vs. sorted(list) article - Memory Consumption
import random
import resource
import sys
import time
from sniffing import FunctionSniffingClass
def list_sort(arr):
return arr.sort()