Skip to content

Instantly share code, notes, and snippets.

Josip Lazić jlazic

  • Croatia
Block or report user

Report or block jlazic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jlazic /
Created May 21, 2016
Add HIT/MISS info to headers with Django cache middleware
from django.views.decorators.cache import decorator_from_middleware_with_args
from django.middleware.cache import CacheMiddleware
class LocalCacheMiddleware(CacheMiddleware):
def process_request(self, request):
response = super(LocalCacheMiddleware, self).process_request(request)
# Add X-Cache: HIT header if response is returned from cache
if response:
response['X-Cache'] = 'HIT'
jlazic /
Created Mar 9, 2015
Split monolithic HAProxy configuration
#Requirements: etckeeper, diffcolor
#This script concatenates multiple files of haproxy configuration into
#one file, and than checks if monolithic config contains errors. If everything is
#OK with new config script will write new config to $CURRENTCFG and reload haproxy
#Also, script will commit changes to etckeeper, if you don't use etckeeper you
#should start using it.
#Script assumes following directory structure:
jlazic / Get-HAProxyStats.ps1
Last active Oct 22, 2019
Monitor HAProxy with PRTG
View Get-HAProxyStats.ps1
# Monitoring HAProxy via CSV stats
# For detailed instructions visit
# Josip Lazic
$templates =@{
You can’t perform that action at this time.