Skip to content

Instantly share code, notes, and snippets.

View tomwojcik's full-sized avatar
🏠

Tomasz Wójcik tomwojcik

🏠
View GitHub Profile
@tomwojcik
tomwojcik / sane-caching.nginx.conf
Created April 8, 2022 07:49 — forked from philipstanislaus/sane-caching.nginx.conf
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
import datetime
DATE_SYSTEM_1900_EPOCH = datetime.datetime(1899, 12, 31)
DATE_SYSTEM_1904_EPOCH = DATE_SYSTEM_1900_EPOCH + datetime.timedelta(days=1462)
def _handle_excel_date_system(
ordinal: Union[str, float],
_epoch: datetime.datetime
) -> Optional[datetime.datetime]:
@tomwojcik
tomwojcik / fix_bluetooth_headphones.sh
Created April 6, 2021 06:59
Not really a script but a list of commands. Random mashup of some of them will fix headphones.
# see what's the bluetooth status
bluetoothctl
# bluetooth config
sudo vi /etc/bluetooth/main.conf
# list wireless devices and if they are enabled
rfkill list
# hard reset of bluetooth
#!/usr/bin/env bash
# run from terminal with
# bash <(curl -Ls gist.githubusercontent.com/tomwojcik/549ddf72117127e54b8317f690954072/raw/1e609d631bffd12aa4e4e526e789821ae6650167/nuke_docker_env.sh)
echo "Stopping all running containers"
docker stop $(docker ps -aq) > /dev/null
echo "Removing all containers"
docker rm $(docker ps -aq) > /dev/null
#!/usr/bin/env bash
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
#!/usr/bin/env bash
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
find . -path "*/*.sqlite3" -delete
echo "Finished."