Skip to content

Instantly share code, notes, and snippets.

View dam2k's full-sized avatar

Dino Ciuffetti dam2k

View GitHub Profile
@dam2k
dam2k / mailcleaner_check_spam_decisive.sh
Last active April 4, 2022 22:29
Parse all identified incoming spam emails from mailcleaner's log /var/mailcleaner/log/mailscanner/infolog and show them clearly
#!/bin/bash
echo "SPAMSCORE|MAILID|SRCIP|SRCMAIL|DSTDOMAIN" 1>&2
grep -P '(?=.*?spam decisive\))(?=.*?Spamc \()' /var/mailcleaner/log/mailscanner/infolog | sed -E -e 's/^[A-Za-z]*.* Message ([-a-zA-Z0-9]*) from ([.:a-zA-Z0-9]*) \(([-_+=.a-zA-Z0-9]*@[-_+=.a-zA-Z0-9]*\.[-_=.a-zA-Z]*)\) to ([-_a-zA-Z]*\.[-_a-zA-Z.]*) .*, Spamc \(score=([0-9.]*), .*$/\5|\1|\2|\3|\4/'
@dam2k
dam2k / test2.cgi
Last active February 19, 2021 10:29
#!/bin/bash
# Apache HTTPD sends STDOUT produced by this script straight to the browser. OK???
# First we send HTTP Response headers, one header per line, each header line terminates with \n.
# A lonly \n character (an empty line) will separate headers from body.
# The HTTP Response body stream will then follow.
# Send Content-Type HTTP response Header to stdout (straight to the browser)
printf 'Content-Type: %s\n' 'text/plain'
# Send HTTP/410
@dam2k
dam2k / test.cgi
Last active February 18, 2021 18:10
Bash CGI HTTP Status code example
#!/bin/bash
function sendcontentheader()
{
printf 'Content-Type: %s\n' "$1"
}
function sendstatuscode()
{
printf 'Status: %s\n' "$1"
#include <stdio.h>
#include <math.h>
// ported in C from http://totologic.blogspot.com/2014/01/accurate-point-in-triangle-test.html?m=1
// really really really thank you!
// compile with -lm (math library)
#define EPSILON 0.00001
const static float epsilon = EPSILON;