Skip to content

Instantly share code, notes, and snippets.

View rayterrill's full-sized avatar

Ray Terrill rayterrill

View GitHub Profile
@rayterrill
rayterrill / update365ServiceStatustoSlackAndCachetHQ.ps1
Last active September 22, 2017 14:56
Updates Slack and a CachetHQ Dashboard with Office365 Service Statuses
param(
[Parameter(Mandatory=$True)][System.Management.Automation.CredentialAttribute()]$cred,
[Parameter(Mandatory=$True)]$cachetToken,
[Parameter(Mandatory=$True)]$slackWebhookURL
)
$DebugPreference = 'Continue'
Import-Module O365ServiceCommunications
@rayterrill
rayterrill / like.js
Created September 22, 2017 14:35
Add a Like/Ratings Button to the SharePoint Item Display Form (DispForm.aspx) to Allow Users to Like an Item from that page
<script language="javascript" type="text/javascript" src="/sites/MySPSite/SiteAssets/jquery-2.2.0.min.js"></script>
<script language="javascript" type="text/javascript" src="/sites/MySPSite/SiteAssets/jquery.SPServices.min.js"></script>
<script type="text/javascript">
SP.SOD.registerSod('reputation.js', '/_layouts/15/reputation.js');
SP.SOD.executeFunc('reputation.js', 'Microsoft.Office.Server.ReputationModel.Reputation', function () {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', LoadRatingFunction);
});
@rayterrill
rayterrill / dashboard.js
Created September 22, 2017 14:44
Bootstrap "Dashboard" Showing Change Control Ticket Status from a SharePoint List (using CSOM)
<script language="javascript" type="text/javascript" src="/sites/MySPSite/SiteAssets/jquery-2.2.0.min.js"></script>
<script language="javascript" type="text/javascript" src="/sites/MySPSite/SiteAssets/jquery.SPServices.min.js"></script>
<script type="text/javascript">
SP.SOD.executeFunc('sp.js','SP.ClientContext',runthiscode);
function getFormattedDate(date) {
var year = date.getFullYear();
@rayterrill
rayterrill / office365AWSRoute54DNS.ps1
Created September 25, 2017 22:06
Create AWS Route53 DNS Records for Office365
Param(
[string]$domainName, #example: mydomain.com
[string]$verificationValue #example: ms23254363
)
$domain_withoutDot = $domainName -Replace '\.', '-'
#make sure you're authenticated to AWS and that you've pre-created the new hosted zone
#get the hosted zone
@rayterrill
rayterrill / office365AWSRoute54DNS.ps1
Created September 25, 2017 22:06
Create AWS Route53 DNS Records for Office365
Param(
[string]$domainName, #example: mydomain.com
[string]$verificationValue #example: ms23254363
)
$domain_withoutDot = $domainName -Replace '\.', '-'
#make sure you're authenticated to AWS and that you've pre-created the new hosted zone
#get the hosted zone
@rayterrill
rayterrill / vlantester.tests.ps1
Created October 7, 2017 17:47
Tests VLANs in VMWare using PowerShell, Pester, and PowerCLI by swapping a VM into different networks, setting an IP, and verifying connectivity.
Connect-VIServer -Server YOUR_VCENTER_SERVER | Out-Null
#build a credential object to connect to the VM at the OS level to switch the network settings
$secpwd = ConvertTo-SecureString "PASSWORD_GOES_HERE" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("ACCOUNT_GOES_HERE", $secpwd)
#set a hash tables of VMWare networks and an IP address in each network
$networks = @{
"VLAN1" = "192.168.1.5"
"VLAN2" = "192.168.2.5"
@rayterrill
rayterrill / anotherExample.js
Last active October 13, 2017 04:31
A simple async NodeJS example
var async = require("async");
function a(callback) {
setTimeout(function() {
console.log('a');
callback();
}, 5000);
}
function b(callback) {
@rayterrill
rayterrill / angular.js
Created October 25, 2017 04:44
More Complicated AngularJS Dropdown JSON Example
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<label for="name">Select a State:</label>
<select id="name" ng-model="selectedName" ng-options="state as state.Name for state in states"></select>
<br />
@rayterrill
rayterrill / UploadAzlogDataToGrayLog.ps1
Created November 17, 2017 15:53
Upload Azlog Data to GrayLog with GELF
$docs = Get-ChildItem C:\users\azlog\AzureActiveDirectoryJson -File
#declare a variable to hold how many messages we're uploading
$messagesUploaded = 0
foreach ($d in $docs) {
$content = Get-Content -Raw -Path "C:\users\azlog\AzureActiveDirectoryJson\$($d.Name)" | ConvertFrom-Json
$records = $content.Records
foreach ($r in $records) {
$obj = New-Object PSObject
Tool Website Description Really Like?
Vagrant https://www.vagrantup.com/ Vagrant is a tool for building and managing virtual machine environments in a single workflow
Kafka https://kafka.apache.org/ Kafka is used for building real-time data pipelines and streaming apps.
InfluxDB https://www.influxdata.com/time-series-platform/influxdb/ InfluxDB is used as a data store for any use case involving large amounts of timestamped data, including DevOps monitoring, application metrics, IoT sensor data, and real-time analytics.
Grafana https://grafana.com/grafana Visualization tool for InfluxDB, Graphite, Prometheus, ElasticSearch, AWS CloudWatch, etc
Etcd https://github.com/coreos/etcd Distributed reliable key-value store for the most critical data of a distributed system
Fluentd https://www.fluentd.org/ Fluentd is an open source data collector for unified logging layer.
RethinkDB https://www.reth