Skip to content

Instantly share code, notes, and snippets.

View marshyon's full-sized avatar

jon brookes marshyon

View GitHub Profile
@marshyon
marshyon / powershell_copy_sharepoint_to_localdir.ps1
Last active January 30, 2022 19:50
Powershell script to copy sharepoint files to a local directory using Powershell Core and PnP.PowerShell
# Input Parameters
# Install-Module -Name PnP.PowerShell -AllowClobber
$folder = "/Shared Documents"
# $backupDir = "C:/Users/USER/projects/powershell/backup"
function New-BackupDir {
$date = Get-Date
@marshyon
marshyon / Proxmox_script_clones.md
Last active November 2, 2023 23:46
proxmox bash script to tear down 2 vms and recreate from a clone

Description

A bash script that will tear down and recreate 2 virtual machines from a clone of another VM on a proxmox server.

this script will DESTROY proxmox hosts

be certain to edit the variables master and worker to match the IDs of VMs in proxmox that you wish to replace for example:

master=100
@marshyon
marshyon / _proxmox_bash_script_to_list_ips_with_qm_command.md
Last active December 16, 2024 11:17
proxmox list ips of running vms

Description

A script that on a proxmox node, will list the ip addresses of running virtual machines.

Pre-requisites

install required packages :

apt-get install net-tools arp-scan
@marshyon
marshyon / main.go
Created December 23, 2019 21:20
Go Postgres SQL connect and select
package main
import (
"database/sql"
"fmt"
"os"
_ "github.com/lib/pq"
)
@marshyon
marshyon / main.go
Created December 18, 2019 18:11
semantic versioning sort and bump
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
"strings"
"github.com/blang/semver"
@marshyon
marshyon / Dockerfile
Created August 26, 2019 14:12
Deploy a Go web service as an Azure Web Application using Docker - Dockerfile
FROM golang:latest as builder
# Add Maintainer Info
LABEL maintainer="Jon Brookes <[email protected]>"
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum jobs.txt ./
@marshyon
marshyon / server.go
Created August 26, 2019 14:10
Deploy a Go web service as an Azure Web Application using Docker - server.go
package main
/*
*
* this uses a file in it's current directory called 'jobs.txt' which may be formed as :
*
* https://jsonplaceholder.typicode.com:443/photos/1
* https://jsonplaceholder.typicode.com:443/todos/1
* https://jsonplaceholder.typicode.com:443/albums/6
*
@marshyon
marshyon / deploy.sh
Created August 26, 2019 10:00
Deploy a Go web service as an Azure Web Application using Docker - deploy.sh
#!/usr/bin/bash
# replace 'uniquename' with your own unique name
# define variables for repeated use in the current script
export RESOURCE_GROUP="uniquenameResourceGroup"
export AZURE_REGISTRY_NAME="uniquenameRegisry"
export DOCKER_IMAGE_NAME="uniquename-custom-docker-image"
export DOCKER_IMAGE_TAG="v1.0.0"
export APP_SERVICE_PLAN_NAME="uniquenameAppServicePlan"
@marshyon
marshyon / windowspacker.json
Created June 30, 2019 18:53
Packer json file to create a windows host on Azure and run commands to sysprep and activate a web server on the subsequent host
{
"builders": [{
"type": "azure-arm",
"client_id": "<client id here>",
"client_secret": "<client secret here>",
"tenant_id": "<tennant id here",
"subscription_id": "<subscription id here>",
"managed_image_resource_group_name": "myPackerGroup",
@marshyon
marshyon / Deploy.PS1
Last active July 2, 2019 08:19
terraform windows host with Microsoft-Windows-Shell-Setup
Start-Transcript -Path C:\Deploy.Log
Write-Host "I could be doing just about anything right now, downloading stuff, running stuff, whatever...."
Write-Host "this is running on the following host : "
$env:computername
Write-Host "the port parameter passed to this script from terraform is $WinRmPort"