This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Exists, OuterRef | |
MyModel.objects.filter( | |
Exists( | |
MyModel.objects.exclude(pk=OuterRef("pk")).filter(col=OuterRef("col")) | |
) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dateutil.relativedelta import FR, SA | |
from dateutil.rrule import rrule, YEARLY | |
STATIC_HOLIDAYS = ( | |
(1, 1), # New years day | |
(1, 6), # Epiphany | |
(5, 1), # International workers' day | |
(6, 6), # National day | |
(12, 24), # Christmas eve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" \v[\(\,]\_s{-}\zs\w+\ze\_s{-}\=(\=)@!(\_s)@! (Original multiline regex) | |
syn match pythonFunctionKeyword "\v\s{-}\zs\w+\ze\=(\=)@!(\_s)@!" display | |
syn cluster pythonExpression add=pythonFunctionKeyword | |
syn region pythonFunctionKwargs start=+(+ end=+)+ keepend contains=@pythonExpression | |
HiLink pythonFunctionKeyword Identifier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Set this up as a cronjob to flush firewall blockades on given time intervals | |
# when configuring of firewall is wanted. Just to avoid putting the machine on | |
# lockdown seen externally. | |
echo "Stopping firewall and allowing everyone..." | |
ipt="/sbin/iptables" | |
## Failsafe - die if /sbin/iptables not found | |
[ ! -x "$ipt" ] && { echo "$0: \"${ipt}\" command not found."; exit 1; } |