Skip to content

Instantly share code, notes, and snippets.

# Replace blank variables with -
#
# map $foo $foo_h {
# default $foo;
# "" -;
# }
map $host $host_h { default $host; "" -; }
log_format lighttpd
'$remote_addr $host_h $remote_user [$time_local] "$request" $status '
'$body_bytes_sent "$http_referer" "$http_user_agent"';
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2009, 2010, 2011, 2012 Matt Nordhoff <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<p>{{ '1'|test.foo() }}</p>
<p>{{ foo }}</p>
</body>
@mnordhoff
mnordhoff / gist:2213179
Last active October 22, 2022 23:17
Python regular expressions for IPv4 and IPv6 addresses and URI-references, based on RFC 3986's ABNF.The URI-reference regular expression includes IPv6 address zone ID support (RFC 6874).
# Python regular expressions for IPv4 and IPv6 addresses and URI-references,
# based on RFC 3986's ABNF.
#
# ipv4_address and ipv6_address are self-explanatory.
# ipv6_addrz requires a zone ID (RFC 6874) follow the IPv6 address.
# ipv6_address_or_addrz allows an IPv6 address with optional zone ID.
# uri_reference is what you think of as a URI. (It uses ipv6_address_or_addrz.)
import re