Skip to content

Instantly share code, notes, and snippets.

@dynax60
dynax60 / check_ping.patch
Created December 3, 2010 14:08
Nagios check_ping plugin: Disable warning message "System call sent warnings to stderr"
--- check_ping.c~ 2008-12-01 00:23:18.000000000 +0300
+++ check_ping.c 2010-12-03 16:40:05.000000000 +0300
@@ -487,7 +487,7 @@
if ((result=error_scan(buf, addr)) == STATE_OK) {
result = STATE_WARNING;
if (warn_text == NULL) {
- warn_text = strdup(_("System call sent warnings to stderr "));
+ /* warn_text = strdup(_("System call sent warnings to stderr ")); */
} else {
asprintf(&warn_text, "%s %s", warn_text, _("System call sent warnings to stderr "));
@dynax60
dynax60 / ping_api.rc
Created December 17, 2010 09:37
Example of FreeBSD rc-file for Mojolicious Hypnotoad Server
#!/bin/sh
# PROVIDE: ping_api
# REQUIRE: NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
name="ping_api"
rcvar=`set_rcvar`
@dynax60
dynax60 / maildirdel.pl
Created January 21, 2011 09:57
Remove helper for Postfixadmin
#!/usr/bin/env perl
use strict;
use warnings;
my $mailhome = '/var/spool/postfix/virtual';
my $domain = shift or die;
my $username = shift or die;
die "Invalid domain: $domain\n" unless $domain =~ m/^[\w\.\-]+$/;
--- delete.orig.php 2011-01-21 12:27:12.000000000 +0300
+++ delete.php 2011-01-21 12:28:38.000000000 +0300
@@ -160,6 +160,8 @@
}
}
+ system("/usr/local/bin/sudo /usr/local/sbin/maildirdel.pl $fDomain $fDelete");
+
if ($error != 1)
{
@dynax60
dynax60 / spamcop-submitter.pl
Created February 2, 2011 07:33
Automate Spamcop Submission
#!/usr/bin/env perl
# Automate Spamcop Submission
use FindBin;
use lib "$FindBin::Bin/mojo/lib";
use Mojo::Client;
$| = 1;
my $client = Mojo::Client->new;
@dynax60
dynax60 / athenians.pl
Created March 9, 2011 05:21
Аффинная система подстановок Цезаря
#!/usr/bin/perl
# Аффинная система подстановок Цезаря
# --dynax60
use strict;
use warnings;
use encoding 'utf8';
use Encode qw(decode);
my ($cmd, $a, $b, $txt) = @ARGV;
@dynax60
dynax60 / genpas-strong.pl
Created March 16, 2011 11:20
Simple password generator
#!/usr/bin/perl
use strict;
use warnings;
my $passcnt = shift || 1; # how much passwords to generate
my $passlen = shift || 8; # password length
my @alph = ('A'..'Z','a'..'z',0..9,'%','*');
my $alph_size = scalar(@alph);
srand($$);
@dynax60
dynax60 / snmp-backup-es3528.sh
Created April 12, 2011 07:25
Configuration backup from ES3528
#!/bin/sh
# ES3528
TFTP_SERVER=${TFTP_SERVER:-"10.X.X.X"}
RW_COMMUNITY=${RW_COMMUNITY:-"private"}
PATH=/bin:/usr/bin:/usr/local/bin
[ -s $1 ] || { echo "No such file or file is empty: $1" >&2; exit 1; }
for h in `cat $1`
@dynax60
dynax60 / snmp-backup-des35xx.sh
Created April 12, 2011 07:57
Configuration backup from DES-35XX, DES-38XX, DES-32XX
#!/bin/sh
# DES-35XX, DES-38XX, DES-32XX
TFTP_SERVER=10.X.X.X
RW_COMMUNITY=private
PATH=/bin:/usr/bin:/usr/local/bin
[ -s $1 ] || { echo "No such file or file is empty: $1"; exit 1; }
for h in `cat $1`
[root@virtual-pbx ~]# mkdir -p /storage/10.0.0.16
[root@virtual-pbx ~]# cat /etc/auto.master | egrep -v '^(#|$)'
/storage /etc/auto.smb.top
[root@virtual-pbx ~]# cat /etc/auto.smb.top | egrep -v '^(#|$)'
* -fstype=autofs,-Dhost=& file:/etc/auto.smb.sub
[root@virtual-pbx ~]# cat /etc/auto.smb.sub | egrep -v '^(#|$)'
* -fstype=cifs,credentials=/root/cifs.conf,uid=0,gid=0 ://10.0.0.16/&
[root@virtual-pbx ~]# cat /root/cifs.conf
username=admin
password=mypassword