Skip to content

Instantly share code, notes, and snippets.

View w-A-L-L-e's full-sized avatar

Walter Schreppers w-A-L-L-e

View GitHub Profile
@w-A-L-L-e
w-A-L-L-e / colorpicker.py
Created May 31, 2022 13:01
Color picker using cliclick log color in both r g b and hex string.
#!/usr/bin/env python3
from time import sleep
import subprocess
# brew install cliclick
def hexcol(c):
hc = f'{hex(c)}'.replace("0x","")
if(len(hc)<2):
hc = f'0{hc}'
@w-A-L-L-e
w-A-L-L-e / feestdagen.py
Last active May 30, 2022 14:16
Feestdagen België en Nederland in python
from datetime import datetime, date, timedelta, timezone
EASTER_JULIAN = 1
EASTER_ORTHODOX = 2
EASTER_WESTERN = 3
def easter(year, method=EASTER_WESTERN):
if not (1 <= method <= 3):
raise ValueError("invalid method")
y = year
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)