Skip to content

Instantly share code, notes, and snippets.

View marshyon's full-sized avatar

jon brookes marshyon

View GitHub Profile
@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"
@marshyon
marshyon / main.tf
Created June 11, 2019 19:16
terraform windows host
# Configure the Microsoft Azure Provider
# provider "azurerm" {
# subscription_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# client_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# client_secret = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# tenant_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# }
# Create a resource group if it doesn’t exist
resource "azurerm_resource_group" "myterraformgroup" {
@marshyon
marshyon / main.tf
Created June 8, 2019 20:50
Terraform create ubuntu host, get newly created IP address, copy files to host, run commands and move files copied to root home directory
# Configure the Microsoft Azure Provider
# provider "azurerm" {
# subscription_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# client_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# client_secret = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# tenant_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# }
# Create a resource group if it doesn’t exist
resource "azurerm_resource_group" "myterraformgroup" {
@marshyon
marshyon / runCommand.ps1
Last active June 2, 2019 14:10
run a command with a powershell script that accepts command line parameters
param (
[string]$user = "",
[string]$pass = "",
[string]$srvAddr = "",
[string]$srvPort = ""
)
$cmd = "c:\path\to\util.exe --user=$user --pass=$pass --srvAddr=$srvAddr --srvPort=$srvPort"
iex $cmd
Verifying my Blockstack ID is secured with the address 18b722UJK9QcX9WAFCCarHPMdgg1iHXbRX https://explorer.blockstack.org/address/18b722UJK9QcX9WAFCCarHPMdgg1iHXbRX
low

from the curent epch time stamp, calculate the current time interval as specified by the variable seconds_interval and create a new date from that epoch

the purpose of this being to store data in a database by the current minute / 5 minute / whatever time period

@marshyon
marshyon / main.go
Last active July 25, 2024 14:36
Golang badger db using GOB to serialise object data into badger fields
/*
*
* Golang badger db using GOB to serialize object data into badger fields
*
* Golang has its very own serializer / deserializer - Go Object (gob) so why not use it where data passed is entirely within a Go
* application ?
*
* JSON or some other text based solution could be used but gob might be faster.
*
* A gob encoder accepts the type bytes.Buffer to encode data to, so to write this to Badger, which accepts the type byte
@marshyon
marshyon / rescan.sh
Last active April 13, 2018 10:05
bash one liners
# rescan devices when in vmware disks have been added
for i in $(ls /sys/class/scsi_device/); do echo "1" > "/sys/class/scsi_device/"$i"/device/rescan"; done
@marshyon
marshyon / README.md
Last active September 6, 2018 20:21
sqlite golang app that creates / takes data from an SQLite database and publishes it through an http JSON REST like web service using the Go gorilla framework

SQLite Golang app that creates / takes data from an SQLite database and publishes it through an http JSON REST like web service using the Go gorilla framework