Skip to content

Instantly share code, notes, and snippets.

View Adron's full-sized avatar
🤘
GSD. Just ping me, I'll get back at ya.

Adron Hall Adron

🤘
GSD. Just ping me, I'll get back at ya.
View GitHub Profile
@Adron
Adron / node.json
Last active August 7, 2019 00:40
The Basic Packer Example from Microsoft's Docs.
{
"variables": {
"client_id": "{{env `TF_VAR_clientid`}}",
"client_secret": "{{env `TF_VAR_clientsecret`}}",
"tenant_id": "{{env `TF_VAR_tenant_id`}}",
"subscription_id": "{{env `TF_VAR_subscription_id`}}"
},
"builders": [{
"type": "azure-arm",
@Adron
Adron / .bash_profile.sh
Created August 1, 2019 20:05
The export of the subscription and tenant ID's for Azure use with Terraform.
export TF_VAR_subscription_id="00000000-0000-0000-0000-000000000000"
export TF_VAR_tenant_id="11111111-1111-1111-1111-111111111111"
@Adron
Adron / main.tf
Created August 1, 2019 20:01
Setting up an Azure Resource Group.
provider "azurerm" {
version = "=1.27.0"
subscription_id = "00000000-0000-0000-0000-000000000000"
tenant_id = "11111111-1111-1111-1111-111111111111"
}
resource "azurerm_resource_group" "adrons_resource_group_workspace" {
name = "adrons_workspace"
@Adron
Adron / install.sh
Created August 1, 2019 17:29
Installing Azure CLI on Debian/Ubuntu Linux
# Update the latest packages and make sure certs, curl, https transport, and related packages are updated.
sudo apt-get update
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg
# Download and install the Microsoft signing key.
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor | \
sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null
# Add the software repository of the Azure CLI.
func main() {
htmlContent, err := ioutil.ReadFile("compositecode.html")
if err != nil {
fmt.Println(err)
}
htmlData := string(htmlContent)
r := strings.NewReader(htmlData)
@Adron
Adron / counting.go
Created July 5, 2019 21:59
TheCountOfWordsAndImages
func CountWordsAndImages(url string) (words, images int, err error) {
resp, err := http.Get(url)
if err != nil {
return
}
doc, err := html.Parse(resp.Body)
resp.Body.Close()
if err != nil {
@Adron
Adron / visit_func.go
Created July 3, 2019 03:12
The Visit Function.
func visit(links []string, n *html.Node) []string {
if n.Type == html.ElementNode && n.Data == "a" {
for _, a := range n.Attr {
if a.Key == "href" {
links = append(links, a.Val)
}
}
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
links = visit(links, c)
@Adron
Adron / types_nodes_etc.go
Created July 3, 2019 03:07
The types, nodes, constants, etc setup for parsing HTML.
type NodeType int32
const (
ErrorNode NodeType = iota
TextNode
DocumentNode
ElementNode
Commentnode
DoctypeNode
)
@Adron
Adron / func_main_plus_example_executor.go
Created July 3, 2019 02:59
A sample function being called from func main.
package main
import "fmt"
func main() {
var this, result int
var that, message string
this = 2
that = "42"
@Adron
Adron / map_types.go
Created May 20, 2019 18:59
Making Map Types Go in Go
package main
import "fmt"
func main() {
ages := map[string]int{
"Peterson": 52,
"Sally": 22,
"Javovia": 15,
"Ben": 42,