Skip to content

Instantly share code, notes, and snippets.

View cuu508's full-sized avatar

Pēteris Caune cuu508

View GitHub Profile
@cuu508
cuu508 / Caddyfile
Created June 4, 2021 09:20
Caddyfile which pings hc-ping.com every 5 minutes
:8081 {
reverse_proxy /secret/ hc-ping.com {
health_uri /8bc796e2-bbd5-4956-8e36-5f7f836b1696
health_interval 5m
health_headers {
Host hc-ping.com
}
}
respond "Hello world"
# crontab -l
5,17,32,47 0-23 * * * logger -t experiment4 `date -Iseconds`
# journalctl --since "2021-03-28" -t experiment4
-- Logs begin at Sat 2021-03-27 00:00:14 GMT, end at Sun 2021-03-28 18:47:01 IST
Mar 28 00:05:01 debian experiment4[1594]: 2021-03-28T00:05:01+00:00
Mar 28 00:17:01 debian experiment4[1605]: 2021-03-28T00:17:01+00:00
Mar 28 00:32:01 debian experiment4[1613]: 2021-03-28T00:32:01+00:00
Mar 28 00:47:01 debian experiment4[1621]: 2021-03-28T00:47:01+00:00
Mar 28 02:00:01 debian experiment4[1629]: 2021-03-28T02:00:01+01:00
@cuu508
cuu508 / linemode.py
Created December 9, 2021 12:55
Experimental {% linemode %} and {% line %} template tags
class LineModeNode(Node):
def __init__(self, nodelist):
self.nodelist = nodelist
def render(self, context):
context["__lines__"] = []
self.nodelist.render(context)
return "\n".join(context["__lines__"])