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 random import * | |
import string | |
min = 10 | |
max = 20 | |
combination = string.ascii_letters + string.digits + string.punctuation | |
var_pass = "".join(choice(combination) for x in range(randint(min, max))) | |
print("Random Password String: ", var_pass) |
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
//double quotes test | |
val pattern = """(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s*(-)\s*(-)\s*(\[.+?\])\s*"(.+?)\s(.+?)\s(.+?)"\s*(\d{1,3})\s*(\d{1,10})\s*"(.+?)"\s*"(.+?)"\s*"(.+?)"""".r; | |
val input = """174.371.196.220 - - [07/Sep/2017:00:06:00 +0000] "GET /cs/v1/points/bal?memberId=2164699082&accountType=10 HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0" "-""""; | |
val res = input match { | |
case pattern(ip, username1, logname2, time, requestType, requestURL, requestMethod, status, bytes, referer, userAgent, filename ) => s"IP=$ip\nUsername=$username1\nLogname=$logname2\nTime=$time\nRequestType=$requestType\nRequestURL=$requestURL\nRequestMethod=$requestMethod\nStatus=$status\nBytes=$bytes\nReferer=$referer\nUserAgent=$userAgent\nFilename=$filename" | |
case _ => "NONE" | |
} | |
print(res) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 hexToRgb(hex) { | |
r = hex.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i); | |
if (r) { | |
return r.slice(1, 4).map(function(x) { | |
return parseInt(x, 16); | |
}); | |
} | |
return null; | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 botocore.exceptions import ClientError | |
from botocore.vendored import requests | |
def send_email(sender, recipient, aws_region, subject): | |
# This address must be verified with Amazon SES. | |
SENDER = sender | |
# If your account is still in the sandbox, this address must be verified. | |
RECIPIENT = recipient | |
# Specify a configuration set. If you do not want to use a configuration |
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
def send_email(sender, recipient, aws_region, subject, file_name): | |
# The email body for recipients with non-HTML email clients. | |
BODY_TEXT = "Hello,\r\nPlease find the attached file." | |
# The HTML body of the email. | |
BODY_HTML = """\ | |
<html> | |
<head></head> | |
<body> | |
<h1>Hello!</h1> | |
<p>Please find the attached file.</p> |
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
def json_to_csv(path, fileInput, fileOutput): | |
inputFile = open(path + fileInput) | |
data = json.load(inputFile) | |
inputFile.close() | |
with open(os.path.join(path,fileOutput), 'w') as fp: | |
output = csv.writer(fp) | |
output.writerow(data[0].keys()) | |
for row in data: | |
output.writerow(row.values()) |
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
import json | |
import requests | |
import time | |
from pytz import timezone | |
import datetime | |
status_dict = {'0':'Running','1':'Running with Errors','12':'Running with Failures','15':'Queueing with Failures'} | |
session_type_dict = {'0':'Backup'} | |
OlderNewer