Skip to content

Instantly share code, notes, and snippets.

View moisseev's full-sized avatar
:octocat:
🎖🎖🎖

Alexander Moisseev moisseev

:octocat:
🎖🎖🎖
View GitHub Profile
@moisseev
moisseev / rspamc_learn.sh
Last active February 25, 2024 13:36
Train Rspamd using Dovecot folders ( * the script expunges folders *)
#!/bin/sh
USER="[email protected]"
FOLDER_PREFIX="train_"
FOLDER_HAM="${FOLDER_PREFIX}ham"
FOLDER_PROB="${FOLDER_PREFIX}prob"
FOLDER_SPAM="${FOLDER_PREFIX}spam"
DOVEADM="/usr/local/bin/doveadm"
RSPAMADM="/usr/local/bin/rspamadm"
RSPAMC_CONNECT="-h localhost:11334" # rspamc (--connect|-h) option
@moisseev
moisseev / filter-stats-graph.in
Last active April 13, 2019 15:38
Simple rrdcgi template for Rspamd throughput RRD (rspamd.rrd)
<!--Rspamd filter stats graph-->
<RRD::GRAPH
<RRD::GETVAR TITLE_PREFIX>_<RRD::GETVAR TITLE_SUFFIX>.png
--font DEFAULT:0:Vera
--font-render-mode mono
--start <RRD::GETVAR START> --end now
--title="Rspamd throughput by <RRD::GETVAR TITLE_SUFFIX>, msg/min"
--height=120
--width=720
@moisseev
moisseev / courier-imap_postfix_last-login.pl
Last active August 29, 2015 14:22
Retrieve the last login and login count of each email account from maillog (courier-imap + postfix)
#!/usr/local/bin/perl -w
#============================================================= -*-perl-*-
# courier-imap_postfix_last-login.pl
#========================================================================
# Version 0.0.1, 2015-06-04
#========================================================================
# Parsing is possible only for one year at time due to syslog date/time format limitation.
# The current year is hardcoded in the script.
@moisseev
moisseev / patch-lib__BackupPC__CGI__Lib.pm.diff
Created April 30, 2015 14:33
BackupPC CGI: Set 404 status code to HTTP header for all objects returned on error.
--- ./lib/BackupPC/CGI/Lib.pm.orig 2015-04-30 16:04:21.000000000 +0300
+++ ./lib/BackupPC/CGI/Lib.pm 2015-04-30 17:04:54.000000000 +0300
@@ -289,7 +289,12 @@
Trailer();
} else {
my $content = eval("qq{$Lang->{Error____head}}");
- Header(eval("qq{$Lang->{Error}}"), $content);
+ Header(
+ eval("qq{$Lang->{Error}}"),
+ $content,
@moisseev
moisseev / BackupExpire-test.pl
Last active August 29, 2015 14:20
Simple test of BackupPC_dump subroutines: BackupExpire and BackupFullExpire.
#!/usr/bin/perl
#============================================================= -*-perl-*-
# Simple test of BackupPC_dump subroutines:
# BackupExpire and BackupFullExpire.
#========================================================================
#
# AUTHOR
# Alexander Moisseev <[email protected]>
#
# COPYRIGHT