This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% dig +aaonly @dns9.linuxpl.com admpassivewindows.ie ANY | |
; <<>> DiG 9.9.5-3ubuntu0.2-Ubuntu <<>> +aaonly @dns9.linuxpl.com admpassivewindows.ie ANY | |
; (1 server found) | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30496 | |
;; flags: qr aa rd; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 3 | |
;; WARNING: recursion requested but not available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To send a email, use the 'mailx' command. This takes the email to send on | |
# standard input. The -s flag is used to specify your subject, and the | |
# recipient address is specified without any flags. Everything after '--' is | |
# passed on to the Mail Transport Agent (MTA, the local mailserver), and the | |
# '-f' flag is used to specify the sender address, while '-F' is used to | |
# specify the sender name. | |
# | |
# See 'man 1 mailx' for details. The Debian packages you can use for this are | |
# 'bsd-mailx' or 'heirloom-mailx', though both present slightly different | |
# command line interfaces. I'm using 'bsd-mailx' here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jul 29 11:10:13 cian knot[86688]: notice: [talideon.eu] NOTIFY, incoming, 2a01:a8:dc2:33::33@53755: unauthorized request | |
Jul 29 11:10:13 cian knot[86688]: notice: [talideon.eu] NOTIFY, incoming, 78.153.202.4@5042: unauthorized request | |
Jul 29 11:10:21 cian knot[86688]: notice: [gaughan.me] NOTIFY, incoming, 78.153.202.4@5042: unauthorized request | |
Jul 29 11:10:22 cian knot[86688]: notice: [gaughan.me] NOTIFY, incoming, 2a01:a8:dc2:33::33@33170: unauthorized request | |
Jul 29 11:10:25 cian knot[86688]: notice: [talideon.com] NOTIFY, incoming, 2a01:a8:dc2:33::33@13798: unauthorized request | |
Jul 29 11:10:25 cian knot[86688]: notice: [talideon.com] NOTIFY, incoming, 78.153.202.4@5042: unauthorized request | |
Jul 29 11:10:25 cian knot[86688]: notice: [stereochro.me] NOTIFY, incoming, 2a01:a8:dc2:33::33@12630: unauthorized request | |
Jul 29 11:10:25 cian knot[86688]: notice: [stereochro.me] NOTIFY, incoming, 78.153.202.4@5042: unauthorized request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)*[a-z](?:[a-z0-9-]*[a-z0-9])$~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_valid_local_part($local) { | |
// I'm not entirely sure about this regex, but it seems to fit was RFC2822 specifies. | |
return preg_match("@^[-a-z0-9!#\$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#\$%&'*+/=?^_`{|}~]+)*\$@", $local); | |
} | |
function is_well_formed_email_address($email) { | |
// We ignore legacy addresses and local addresses. | |
$parts = explode('@', $email, 2); | |
if (count($parts) != 2) { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function can_host_receive_mail($host) { | |
if (checkdnsrr($host, 'MX')) { | |
return true; | |
} | |
// We try the host itself if it exists no MX records were found, as per | |
// RFC2821. | |
if (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')) { | |
$h = @fsockopen($host, 25, $errno, $errstr, 30); | |
if ($h) { | |
fclose($h); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_well_formed_hostname($host) { | |
return preg_match('~^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)*[a-z](?:[a-z0-9-]*[a-z0-9])$~', $host); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!is_well_formed_email_address($email)) { | |
echo "Email address is not well-formed.\n"; | |
} else { | |
list(, $host) = explode('@', $email, 2); | |
if (can_host_receive_mail($host)) { | |
echo "Host $host can receive mail.\n"; | |
} else { | |
echo "Host $host can't receive mail.\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# pipedarg | |
# by Keith Gaughan <http://talideon.com/> | |
# | |
# The software is hereby placed in the public domain, and the author | |
# disclaims ownership over it and all responsibility for any damage caused | |
# directly or indirectly through its use. It may be freely copied and/or | |
# mangled, provided that altered versions have a different name and are | |
# not attributed to the original author. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import count | |
def sieve(): | |
""" | |
The Sieve of Erastosthenes. | |
If you wanted to speed this up, your best bets are to throw in a wheel. | |
The heapq module's already written in C, so that's as fast as it's going | |
to get, though if you can think of a way to avoid quite so many calls to | |
heapq.heapreplace() (or prevent if from sifting the heap prematurely for |