Skip to content

Instantly share code, notes, and snippets.

View Morreski's full-sized avatar
🦙

Enguerrand Pelletier Morreski

🦙
  • Memento
  • France
View GitHub Profile
@Morreski
Morreski / gitodo.py
Created June 15, 2022 16:05
Quick and dirty script that print TODOs and FIXMEs in a git repository sorted by commit date
#!/usr/bin/python3
import os
import sys
import subprocess
import argparse
import dataclasses
from typing import Iterable, Optional
from datetime import datetime, timezone
@dataclasses.dataclass
@Morreski
Morreski / timed_cache.py
Last active December 21, 2023 18:17
Python lru_cache with timeout
from datetime import datetime, timedelta
import functools
def timed_cache(**timedelta_kwargs):
def _wrapper(f):
update_delta = timedelta(**timedelta_kwargs)
next_update = datetime.utcnow() + update_delta
# Apply @lru_cache to f with no cache size limit
@Morreski
Morreski / serve.py
Last active August 4, 2020 19:15 — forked from chrisbolin/serve.py
Python SimpleHTTPServer for Static Serving (React / Angular / Ember) in HTML5 mode (a la mod_rewrite)
'''
Taken from:
http://stackoverflow.com/users/1074592/fakerainbrigand
http://stackoverflow.com/questions/15401815/python-simplehttpserver
'''
import sys
import os
if sys.version_info < (3,):
import SimpleHTTPServer as server