Skip to content

Instantly share code, notes, and snippets.

@thomd
thomd / virtual-machine.txt
Created Jun 7, 2021
Create Azure Virtual Machine #azure #example
View virtual-machine.txt
#cloud-config
package_upgrade: true
packages:
- nginx
write_files:
- owner: www-data:www-data
path: /etc/nginx/sites-available/default
content: |
server {
listen 80;
@thomd
thomd / virtual-machine-scale-set.txt
Created Jun 7, 2021
Example of a Azure Virtual Machine Scale Set #azure #example
View virtual-machine-scale-set.txt
# cloud-config
package_upgrade: true
packages:
- nginx
- nodejs
- npm
write_files:
- owner: www-data:www-data
path: /etc/nginx/sites-available/default
content: |
@thomd
thomd / main.tf
Created May 13, 2021
Azure CosmosDB with Terraform #az #terraform
View main.tf
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.26"
}
}
}
provider "azurerm" {
@thomd
thomd / main.tf
Last active May 13, 2021
Azure Functions with Terraform #az #terraform
View main.tf
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.26"
}
}
}
provider "azurerm" {
@thomd
thomd / crawl.go
Created Oct 3, 2020
Investigating Webscraping with colly #go
View crawl.go
package main
import (
"encoding/base64"
"flag"
"fmt"
"strings"
"github.com/gocolly/colly"
"github.com/gookit/color"
@thomd
thomd / wiki.go
Last active Sep 14, 2020
Go Examples #golang #go #code
View wiki.go
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
@thomd
thomd / filter.go
Last active Sep 7, 2020
Go Examples #golang #go #code
View filter.go
package model
import (
"fmt"
)
type Person struct {
Name string
Age int
}
@thomd
thomd / workspace_utils.py
Last active Apr 17, 2020
Keeping Your Session Active in Google Colab
View workspace_utils.py
# The workspace_utils.py module includes an iterator wrapper called keep_awake and a context manager
# called active_session that can be used to maintain an active session during long-running processes.
# The two functions are equivalent, so use whichever fits better in your code.
#
# EXAMPLE 1
#
# from workspace_utils import keep_awake
# for i in keep_awake(range(5)): #anything that happens inside this loop will keep the workspace active
# # do iteration with lots of work here
#