Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
use strict;
use warnings;
use Cwd;
use Data::Dumper;
my $DEBUG = 1;
#!/usr/bin/perl
use strict;
use warnings;
# 222.169.193.162 - - [15/Dec/2017:07:24:34 -0500] "GET / HTTP/1.0" 302 483 "-" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9850; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.254 Mobile Safari/534.11+"
my %ips;
my $cnt = 0;
@SergeyStorm
SergeyStorm / tll.pl
Last active September 10, 2017 11:26
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(setitimer ITIMER_REAL);
# Задаём все переменные
# Команда, которую нужно запускать
#!/usr/bin/perl
use strict;
use warnings;
open LOG, '-|', 'tail -f /var/log/apache2/_________.su.access.log';
while( my $line = <LOG> ) {
if ( $line =~ /WordPress/ ) {
my @fields = split( /\s+/, $line );
#!/usr/bin/perl
# Script to monitor top senders via your exim server in realtime
use strict;
no warnings;
use Text::Table;
# Default amount of top senders, may be overriden by commandline argument
my $default_top = 40;
#!/bin/bash
#
# /etc/rc.d/init.d/exim-qtmpfs
#
# <description of the *service*>
# <any general comments about this init script>
#
# chkconfig: 2345 60 40
#
# Tested on CentOS release 6.6 (Final)
#!/bin/bash
path=$1
if [ -d $path ]
then
dirs=$(ls -1 $path | grep -v home)
for i in $dirs
do
if [ -d $path$i ]
then
#!/usr/bin/perl
my $path = $ARGV[0];
if ( -d $path ) {
if ( opendir DIR, $path ) {
my @dirs;
for my $item ( readdir DIR ) {
if ( -d $path.$item ) {
next if $item =~ m|^home|;
next if $item =~ m|^..$|;
import os
import sys
d = sys.argv[1]
subdirs = []
for o in os.listdir( d ):
if os.path.isdir( os.path.join( d, o )):
subdirs.append( os.path.join( d, o ) )
if '/home' in subdirs:
subdirs.remove( '/home' )
#!/usr/bin/perl
# Perl Array vs Hash (using hash like an array)
# Script measures filling and fetching speeds of arrays and hashes in Perl 5
use strict;
use warnings;
use Time::HiRes qw( time );