Skip to content

Instantly share code, notes, and snippets.

View muslu's full-sized avatar

Muslu YÜKSEKTEPE muslu

View GitHub Profile
@krushik
krushik / log_mask.lua
Last active December 15, 2021 07:20
mask passwords in apache access logs with mod_lua
-- apache's %r log field (request line) is read only, we can't fix data in there,
-- so you need to change your LogFormat with '%m %U%q %H' instead of '%r' to get this masking effect
function log_mask_password(r)
-- manually parse request line, needed to overwrite r.uri to mimick apache's %r percent-encoding in %U for non-latin chars
local url = r.the_request:match"^%S+%s(.+)%sHTTP/[%d.]+$" -- ex.: GET /foo?bar=1 HTTP/1.1
-- in case of malformed http request, use apache's uri variant
if not url then
url = r.uri
end
@haproxytechblog
haproxytechblog / blog20180921-01.cfg
Last active November 28, 2022 16:27
Introduction to HAProxy Stick Tables
backend webfarm
stick-table type ip size 1m expire 10s store http_req_rate(10s)
# other configuration...
@ahupowerdns
ahupowerdns / lua.md
Last active July 18, 2024 17:53
The LUA record type for Lua-powered DNS records

LUA Record Type for Lua-powered DNS records for standards based fail-over and geographical load balancing

GitHub branch -> https://github.com/ahupowerdns/pdns/tree/luarec

Recently, many zone owners could not migrate away from Dyn since they were benefiting from non-standardised DNS-based failover and geographical loadbalancing features. What you see below is an attempt to get standards based but flexible equivalents of these currently proprietary features. Here is a zone:

$TTL 60
lua.br. IN      SOA     a.lua.br. nstld.verisign-grs.com. (
        2016032300      ; Serial
        14400           ; Refresh
@haliphax
haliphax / vtecho.py
Created February 25, 2016 21:35
Player script for textfiles.com VT100 animations
#!/usr/bin/env python2.7
"""
This script will echo each line in either stdin or a given file,
with a 1/50th of a second delay between each. This makes it
suitable for "playing" the animations found on textfiles.com:
http://artscene.textfiles.com/vt100/
Just use it like this:
@james2doyle
james2doyle / apache.lua
Created February 14, 2015 15:59
An example of a Lua script being run under Apache mod_lua. From http://httpd.apache.org/docs/current/mod/mod_lua.html
require "string"
--[[
http://httpd.apache.org/docs/current/mod/mod_lua.html
This is the default method name for Lua handlers, see the optional
function-name in the LuaMapHandler directive to choose a different
entry point.
--]]
function handle(r)
r.content_type = "text/plain"