Skip to content

Instantly share code, notes, and snippets.

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 / crash.log
Created Aug 8, 2019
The Error I've been getting from Packer image building on Azure.
View crash.log
2019/08/08 16:07:29 [INFO] Packer version: 1.4.2
2019/08/08 16:07:29 Packer Target OS/Arch: linux amd64
2019/08/08 16:07:29 Built with Go Version: go1.12.6
2019/08/08 16:07:29 Detected home directory from env var: /home/adron
2019/08/08 16:07:29 Using internal plugin for proxmox
2019/08/08 16:07:29 Using internal plugin for amazon-ebs
2019/08/08 16:07:29 Using internal plugin for amazon-ebsvolume
2019/08/08 16:07:29 Using internal plugin for hyperv-iso
2019/08/08 16:07:29 Using internal plugin for linode
2019/08/08 16:07:29 Using internal plugin for ncloud
@Adron
Adron / node.json
Last active Aug 7, 2019
The Basic Packer Example from Microsoft's Docs.
View node.json
{
"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 Aug 1, 2019
The export of the subscription and tenant ID's for Azure use with Terraform.
View .bash_profile.sh
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 Aug 1, 2019
Setting up an Azure Resource Group.
View main.tf
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 Aug 1, 2019
Installing Azure CLI on Debian/Ubuntu Linux
View install.sh
# 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.
View TheCountingRecursionOfThings.go
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 Jul 5, 2019
TheCountOfWordsAndImages
View counting.go
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 Jul 3, 2019
The Visit Function.
View visit_func.go
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 Jul 3, 2019
The types, nodes, constants, etc setup for parsing HTML.
View types_nodes_etc.go
type NodeType int32
const (
ErrorNode NodeType = iota
TextNode
DocumentNode
ElementNode
Commentnode
DoctypeNode
)
@Adron
Adron / func_main_plus_example_executor.go
Created Jul 3, 2019
A sample function being called from func main.
View func_main_plus_example_executor.go
package main
import "fmt"
func main() {
var this, result int
var that, message string
this = 2
that = "42"