This file contains hidden or 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
import email.parser | |
from email import policy | |
def openFromFile(fp) -> email.message.EmailMessage: | |
""" | |
Read in the open file pointer | |
:param fp: file pointer to open file. | |
:type fp: file pointer | |
:returns: msg which is an email.message.EmailMessage |
This file contains hidden or 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
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna! | |
([一-龯]) | |
Regex for matching Hirgana or Katakana | |
([ぁ-んァ-ン]) | |
Regex for matching Non-Hirgana or Non-Katakana | |
([^ぁ-んァ-ン]) | |
Regex for matching Hirgana or Katakana or basic punctuation (、。’) |
This file contains hidden or 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
use trust_dns_resolver::config::*; | |
use trust_dns_resolver::Resolver; | |
// Note you should add the crate to your Cargo.toml file | |
// trust-dns-resolver = "0.20.1" | |
fn main() { | |
// Construct a new Resolver with default configuration options | |
let resolver = Resolver::new(ResolverConfig::default(), ResolverOpts::default()).unwrap(); |
This file contains hidden or 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
use trust_dns_resolver::error::ResolveResult; | |
use trust_dns_resolver::Resolver; | |
use trust_dns_resolver::{config::*, lookup::SoaLookup}; | |
fn main() { | |
// Construct a new Resolver with default configuration options | |
let resolver = Resolver::new(ResolverConfig::default(), ResolverOpts::default()).unwrap(); | |
let soa_response = resolver.soa_lookup("gmail.com."); |
This file contains hidden or 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
use trust_dns_resolver::error::ResolveResult; | |
use trust_dns_resolver::Resolver; | |
use trust_dns_resolver::{config::*, lookup::TxtLookup}; | |
fn main() { | |
// Construct a new Resolver with default configuration options | |
let resolver = Resolver::new(ResolverConfig::default(), ResolverOpts::default()).unwrap(); | |
// Lookup the IP addresses associated with a name. | |
// The final dot forces this to be an FQDN, otherwise the search rules as specified |
This file contains hidden or 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
use regex::{Regex, RegexSet}; | |
fn main() { | |
let string1 = "a:test"; | |
let string2 = "a/24"; | |
let string3 = "a"; | |
let string4 = "a:test/24"; | |
// Create a RegexSet | |
let regex_set = RegexSet::new(&[r"(a$)", r"a:(.*)", r"a(/\d{1,2})"]).unwrap(); |
This file contains hidden or 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
fn main() { | |
let regex = regex::Regex::new(r"(?P<a_only>a$)|(?:a:)(?P<a_colon>[^/].+)|(?P<a_slash>a/\d{1,2})").unwrap(); | |
[ | |
"a", | |
"a:example.com", | |
"a:mailers.example.com", | |
"a/24", | |
"a:offsite.example.com/24]", | |
] |