From a798841c8c89fdb8c072576d683d99ad4eccc052 Mon Sep 17 00:00:00 2001 From: Milan Pollock Date: Fri, 8 Sep 2023 23:25:02 -0400 Subject: [PATCH] updates for atl dev con --- README.md | 2 +- github_copilot/index_1.py | 6 +- github_copilot/index_10.js | 4 +- github_copilot/index_11.js | 6 +- github_copilot/index_12.js | 32 ++------- github_copilot/index_2.py | 2 +- github_copilot/index_3.py | 6 +- github_copilot/index_4.py | 8 +-- github_copilot/index_5.py | 7 +- github_copilot/index_6.py | 7 +- github_copilot/index_7.py | 14 +++- github_copilot/{index_9.cs => index_8.cs} | 1 + github_copilot/index_8.py | 4 -- github_copilot/index_9.js | 3 + github_copilot/main.tf | 82 +++++++++++++++++++++++ 15 files changed, 127 insertions(+), 57 deletions(-) rename github_copilot/{index_9.cs => index_8.cs} (99%) delete mode 100644 github_copilot/index_8.py create mode 100644 github_copilot/index_9.js create mode 100644 github_copilot/main.tf diff --git a/README.md b/README.md index fef3e3cd..dc6b97f1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Jonathan Milan Pollock, MS -I’m one of the lucky ones, to have an over 20-year career that’s also a passion. How many can say they honestly love their day jobs? With both the excitement and reward of building new and refining older enterprise solutions, it’s like playing with Legos for adults! This enjoyment has led me to obtaining my master’s at the University of Michigan in Computer Information Science with a specialization in Data Engineering, avid reading and learning new skills, and the overall opportunity to help and teach others. I’m fortunate to architect, lead, develop and deploy cloud projects, having my kind of fun! +I’m one of the lucky ones, to have an over 20-year career that’s also a passion. With both the excitement and reward of building new and refining older enterprise solutions, it’s like playing with Legos for adults! This enjoyment has led to avid reading, learning new skills, and the overall opportunity to help and teach others. I’m fortunate to architect, lead, develop and deploy cloud-based projects, having my kind of fun! --- diff --git a/github_copilot/index_1.py b/github_copilot/index_1.py index 5fc471e3..d28c6314 100644 --- a/github_copilot/index_1.py +++ b/github_copilot/index_1.py @@ -1,4 +1,8 @@ -# q: how's the lunch and learn going? +# q: how's the demo going? + + + + diff --git a/github_copilot/index_10.js b/github_copilot/index_10.js index 48db5171..7cdfd885 100644 --- a/github_copilot/index_10.js +++ b/github_copilot/index_10.js @@ -1,3 +1,3 @@ -const token = process.env["TWITTER_TOKEN"] +import d3 from "d3" -const fetchTweets = \ No newline at end of file +const drawScatterplot diff --git a/github_copilot/index_11.js b/github_copilot/index_11.js index 7cdfd885..372474ed 100644 --- a/github_copilot/index_11.js +++ b/github_copilot/index_11.js @@ -1,3 +1,5 @@ -import d3 from "d3" +const https = require('https'); +const parseString = require('xml2js').parseString; +const apiKey = process.env["GOODREADS_API_KEY"] -const drawScatterplot +const getRatingFromGoodreads = \ No newline at end of file diff --git a/github_copilot/index_12.js b/github_copilot/index_12.js index b94c0315..3437c3a9 100644 --- a/github_copilot/index_12.js +++ b/github_copilot/index_12.js @@ -1,28 +1,4 @@ -const https = require('https'); -const parseString = require('xml2js').parseString; -const apiKey = process.env["GOODREADS_API_KEY"] - -const getRatingFromGoodreads = (bookTitle) => { - return new Promise((resolve, reject) => { - const url = `https://www.goodreads.com/book/title.xml?key=${apiKey}&title=${encodeURIComponent(bookTitle)}`; - https.get(url, (res) => { - if (res.statusCode !== 200) { - reject(new Error(`Status code: ${res.statusCode}`)); - } else { - let body = ''; - res.on('data', (chunk) => { body += chunk; }); - res.on('end', () => { - parseString(body, (err, result) => { - if (err) { - reject(err); - } else { - resolve(result.GoodreadsResponse.book[0].average_rating[0]); - } - }); - }); - } - }).on('error', (err) => { - reject(err); - }); - }); -} +const v = new Vector([1, 2, 3]); +v.clear(); +console.log(v.size()); +console.log(v.empty()); diff --git a/github_copilot/index_2.py b/github_copilot/index_2.py index 17cdf6a1..33ba78ee 100644 --- a/github_copilot/index_2.py +++ b/github_copilot/index_2.py @@ -1,4 +1,4 @@ ''' Function to find area of a triangle ''' -#def \ No newline at end of file +#def diff --git a/github_copilot/index_3.py b/github_copilot/index_3.py index 9a8e3050..45da987f 100644 --- a/github_copilot/index_3.py +++ b/github_copilot/index_3.py @@ -1,4 +1,6 @@ ''' -API Wrapper MethodView blueprint with body for the Flask smorest API +given I post a book +when the API returns an invalid response +then API wrapper should return an error ''' -class +#def \ No newline at end of file diff --git a/github_copilot/index_4.py b/github_copilot/index_4.py index ae8a2dc1..e9ffb837 100644 --- a/github_copilot/index_4.py +++ b/github_copilot/index_4.py @@ -1,6 +1,6 @@ -from github_copilot.index_2 import APIWrapper - ''' -Test the APIWrapper class +1. Function to create 100 random users using faker library +2. Each user should have between 1 and 5 posts +3. The user and the post should be sent to the API via a post request ''' -#def tes +#def \ No newline at end of file diff --git a/github_copilot/index_5.py b/github_copilot/index_5.py index 380a2b2d..558273ed 100644 --- a/github_copilot/index_5.py +++ b/github_copilot/index_5.py @@ -1,5 +1,2 @@ -''' -given I put an image -when The Post ID is invalid -then API wrapper should return an error -''' +def max_sum_slice(xs): + pass diff --git a/github_copilot/index_6.py b/github_copilot/index_6.py index 534f3db8..6c8033c0 100644 --- a/github_copilot/index_6.py +++ b/github_copilot/index_6.py @@ -1,5 +1,2 @@ -''' -1. Function to create 100 random users using faker library -2. Each user should have between 1 and 5 posts -3. The user and the post should be sent to the API via a post request -''' +def get_code_field(): + pass \ No newline at end of file diff --git a/github_copilot/index_7.py b/github_copilot/index_7.py index 558273ed..7fe31b10 100644 --- a/github_copilot/index_7.py +++ b/github_copilot/index_7.py @@ -1,2 +1,12 @@ -def max_sum_slice(xs): - pass +import re + +e_regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$' +p_regex = r'^[0-9]{3}-[0-9]{3}-[0-9]{4}$' +s_regex = r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$' +s2_regex = r'^[0-9]{3}-[0-9]{2}-[0-9]{4}$' + +def check_valid(text, regex): + if re.search(regex, text): + print("Valid") + else: + print("Invalid") diff --git a/github_copilot/index_9.cs b/github_copilot/index_8.cs similarity index 99% rename from github_copilot/index_9.cs rename to github_copilot/index_8.cs index 4693a2c0..a7ead354 100644 --- a/github_copilot/index_9.cs +++ b/github_copilot/index_8.cs @@ -3,3 +3,4 @@ namespace dotnet_copilot.Data; // create a speaker class with id, name, and bio + diff --git a/github_copilot/index_8.py b/github_copilot/index_8.py deleted file mode 100644 index f2c09178..00000000 --- a/github_copilot/index_8.py +++ /dev/null @@ -1,4 +0,0 @@ -def get_code_field(): - - # Add a code field with a pattern of three capital letters, a dash and three digits - diff --git a/github_copilot/index_9.js b/github_copilot/index_9.js new file mode 100644 index 00000000..c3ffa633 --- /dev/null +++ b/github_copilot/index_9.js @@ -0,0 +1,3 @@ +const token = process.env["TWITTER_TOKEN"] + +const fetchTweets = \ No newline at end of file diff --git a/github_copilot/main.tf b/github_copilot/main.tf new file mode 100644 index 00000000..cc45289d --- /dev/null +++ b/github_copilot/main.tf @@ -0,0 +1,82 @@ +# 1. Specify the version of the AzureRM Provider to use +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "=3.0.1" + } + } +} + +provider "azurerm" { + features {} +} + +# Create a resource group +resource "azurerm_resource_group" "terraformRG" { + name = "terraformRG" + location = "eastus" +} + +# Create a virtual network in the resource group +resource "azurerm_virtual_network" "terraformVNet" { + name = "terraformVNet" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.terraformRG.location + resource_group_name = azurerm_resource_group.terraformRG.name +} + +# Create a subnet in the virtual network +resource "azurerm_subnet" "terraformSubnet" { + name = "internal" + resource_group_name = azurerm_resource_group.terraformRG.name + virtual_network_name = azurerm_virtual_network.terraformVNet.name + address_prefixes = ["10.0.2.0/24"] +} + +# Create a network interface card (nic) for the virtual machine +resource "azurerm_network_interface" "terraformNIC" { + name = "terraformNIC" + location = azurerm_resource_group.terraformRG.location + resource_group_name = azurerm_resource_group.terraformRG.name + + ip_configuration { + name = "internal" + subnet_id = azurerm_subnet.terraformSubnet.id + private_ip_address_allocation = "Dynamic" + } +} + +# Create virtual machine +resource "azurerm_windows_virtual_machine" "terraformVM" { + name = "terraformVM" + resource_group_name = azurerm_resource_group.terraformRG.name + location = azurerm_resource_group.terraformRG.location + size = "Standard_DS1_v2" + admin_username = "adminuser" + admin_password = "P@$$w0rd1234!" + network_interface_ids = [ + azurerm_network_interface.terraformNIC.id, + ] + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "MicrosoftWindowsServer" + offer = "WindowsServer" + sku = "2016-Datacenter" + version = "latest" + } +} + +# Can access data that was accessed somewhere else +data "azurerm_resource_group" "terraformRG" { + name = "terraformRG" +} + +output "id" { + value = data.azurerm_resource_group.terraformRG.id +}