Come to SQL Saturday Rochester 2017, and see both of my sessions, Stretch Database and Managed Backups: Cloud Services for your SQL Servers and SQL Server vNext (Linux and Beyond)
I am speaking at SQL Saturday Pittsburgh 2016!
I will be presenting my third SQLSaturday session at the upcoming Pittsburgh #545 Saturday, Aug. 13th, 2016.
My session, Stretch Database and Managed Backups: Cloud Services for your SQL Servers, is a beginner track session going through the setup, configuration, usage and some real-world usage scenarios for both of these recently added features to the SQL Server product.
Have you registered yet? Why not?
I am speaking at SQL Saturday Indy 2016!
That’s right, back-to-back roll. I will be presenting my second SQLSaturday session at the upcoming Indianapolis #530, Saturday, Aug. 13th, 2016.
My session, Stretch Database and Managed Backups: Cloud Services for your SQL Servers, is a beginner track session going through the setup, configuration, usage and some real-world usage scenarios for both of these recently added features to the SQL Server product.
Have you registered yet? Why not?
I am speaking at SQL Saturday Louisville 2016!
That’s right. My way of giving back to the SQL Server community, I am presenting my first SQLSaturday session at the upcoming Louisville #531, Saturday, Aug. 6th, 2016.
My session, Stretch Database and Managed Backups: Cloud Services for your SQL Servers, is a beginner track session going through the setup, configuration, usage and some real-world usage scenarios for both of these recently added features to the SQL Server product.
Have you registered yet? Why not?
Testing Restful APIs with Curl
Ultra simple way to test a JSON API POST response using curl
1 |
curl -X POST -H "Content-Type: application/json" -d { \"title\\": \"value1\" }" http://apisomewhere:8080/api/something |
Watch out for single quotes, they don’t pass well in windows
My Chocolatey list
You know what Chocolatey is, right?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
choco install 7zip -y choco install putty -y choco install notepadplusplus -y choco install sysinternals -y choco install vlc -y choco install tortoisesvn -y choco install pdfcreator -y choco install winscp -y choco install keypass -y choco install windirstat -y choco install winmerge -y choco install greenshot -y choco install powergui -y choco install texmaker -y choco install ditto -y choco install crashplan -y choco install dropbox -y choco install firefox -y |
Hyper-V Backup Script
The following powershell script creates snapshots or exports of VMs on the local, and performs retention/cleanup as well. Be forewarned. There are known bugs with the current hyper-v snapshot integration and *nix systems.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
<# .SYNOPSIS vmbackup - Creates snapshots or exports of VMs on this server .DESCRIPTION vmbackup - Creates snapshots or exports of VMs on this server .PARAMETER mode [Required] Snapshot mode or export/backup mode .PARAMETER snap_days_retention [Optional] Number of days to retain snapshots (defaults 3) .PARAMETER num_exports_retention [Optional] Number of exports to retain (defaults 2) .PARAMETER export_path [Optional] Path to export to .PARAMETER debug [Optional] Outputs debug level details .NOTES #> Param( [Parameter(Mandatory=$true)] [ValidateSet('snapshot','export')] [string]$mode, [int]$num_exports_retention=2, [int]$snap_days_retention=1, [string]$export_path='F:\ExportedVMs', [string]$Logfile='C:\Scripts\Log\vmbackup.log' ) $ErrorActionPreference = "Stop" <# Formated output #> function Write-Output($message, $iserror=$false) { $message = ("{0} {1}" -f (Get-Date -Format s), $message); if ($iserror -eq $true) { $Host.UI.WriteErrorLine($message); } else { Write-Host $message; } } <# Snapshot all running VMs, and delete snapshots older than given days #> function snapshotAllRunningVMs($snap_days_retention) { # Get list of VMs (that are running) Get-VM | Where {$_.State -eq 'Running'} | ForEach-Object { # Create a snapshot Checkpoint-VM -VM $_; # Delete snapshots older than $snap_days_retention days Get-VMSnapshot -VM $_ | Where {$_.CreationTime -lt (Get-Date).AddDays(-$snap_days_retention)} | Remove-VMSnapshot; } } <# Returns true if given string is a parseable date #> function isDate([string]$date) { $result = 0 if (!([DateTime]::TryParse($date, [ref]$result))) { return $false; } return $true; } <# Performs a export backup of config and data togiven path for all vms with a subdirectory dated #> function exportALLVMs($exports_retention, $export_path) { # Create our backup folder $bk_folder = (Join-Path $export_path $(get-date -f yyyy-MM-dd)); New-Item -ItemType Directory -Force -Path $bk_folder | Out-Null; Write-Output ("Exporting VMs to {0}" -f $bk_folder); try { # Get list of all VMs Get-VM | ForEach-Object { Write-Output ("Exporting {0}..." -f $_.Name); $_ | Export-VM -Path $bk_folder; } } catch [Exception] { echo $_.Exception|format-list -force exit -1; } try { # Delete directories over the number retention Get-ChildItem -Path $export_path -Directory | Where { isDate $_.Name -eq $true } | Where { ([DateTime] $_.Name ) -lt (Get-Date).AddDays(-$exports_retention)} | ForEach-Object { Write-Output ("Remove exports for {0}" -f $_.Name); # Remove folder recursivly Remove-Item -Recurse -Force $_.FullName; } } catch [Exception] { echo $_.Exception|format-list -force exit -2; } } if ($mode -eq 'snapshot') { snapshotAllRunningVMs $snap_days_retention; } if ($mode -eq 'export') { exportAllVMs $num_exports_retention $export_path; } |
60 Second IPA
My clone of nothing…just 60 seconds of hopping involved, how much easier could it be.
Recipe Spec
1 2 3 4 5 6 7 8 9 10 |
Boil Size: 6.52 gal Post Boil Volume: 5.98 gal Batch Size (fermenter): 5.00 gal Bottling Volume: 4.60 gal Estimated OG: 1.070 SG Estimated Color: 5.1 SRM Estimated IBU: 74.8 IBUs Brewhouse Efficiency: 72.00 % Est Mash Efficiency: 82.8 % Boil Time: 60 Minutes |
Ingredients
1 2 3 4 5 6 7 8 9 10 11 12 |
Amt Name Type # %/IBU 13 lbs Pale Malt (2 Row) US (2.0 SRM) Grain 1 97.2 % 6.1 oz Amber Malt (22.0 SRM) Grain 2 2.8 % 1.00 oz Warrior [16.70 %] - Boil 60.0 min Hop 3 49.5 IBUs 0.50 oz Amarillo [8.80 %] - Boil 35.0 min Hop 4 10.8 IBUs 0.50 oz Simcoe [12.70 %] - Boil 30.0 min Hop 5 14.5 IBUs 1.00 oz Amarillo [8.80 %] - Boil 0.0 min Hop 6 0.0 IBUs 1.0 pkg California Ale (White Labs #WLP001) [35. Yeast 7 - 0.50 oz Amarillo [9.20 %] - Dry Hop 7.0 Days Hop 8 0.0 IBUs 0.50 oz Amarillo [9.20 %] - Dry Hop 7.0 Days Hop 9 0.0 IBUs 0.50 oz Simcoe [13.00 %] - Dry Hop 7.0 Days Hop 10 0.0 IBUs 0.50 oz Simcoe [13.00 %] - Dry Hop 0.0 Days Hop 11 0.0 IBUs |
Mash
1 2 3 4 5 6 |
Mash Schedule: Single Infusion, Full Body, Batch Sparge Total Grain Weight: 13 lbs 6.1 oz ---------------------------- Name Description Step Temperature Step Time Mash In Add 4.72 gal of water at 166.1 F 156.0 F 60 min Sparge: Batch sparge with 2 steps (0.41gal, 3.53gal) of 168.0 F water |
Make ServiceNow SOAP calls with PowerShell
The following PS script shows how to query ServiceNow via SOAP calls, using the WebServiceProxy object. View their Wiki for more examples of service methods
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$username = "XXXXXXXXXX" $password = "YYYYYYYYYY" $instance = "ZZZZZZZZZZ" $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force)) $sn = New-WebServiceProxy -Uri "https://$instance.service-now.com/incident.do?WSDL" –Credential $cred #get autogenerated namespace $type = $sn.GetType().Namespace # Get a single record by sys_id #$get = new-object ($type + '.get') #$get.sys_id="YOUR_SYS_ID_GOES_HERE" #$sn.get($get) #Get records that match values #$getRecords = new-object ($type + '.getRecords') #$getRecords.state=11 #$sn.getRecords($getRecords); |
Synchronize File Timestamps
To synchronize file timestamps (creation, last access and last write) of two directory trees.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
$src = "\\some\src\path"; $dest = "Z:\some\dest\"; function Sync-FileTimes($src,$dest) { $src ForEach ($srcitm in Get-ChildItem -Path $src) { $destitmpath = (Join-Path $dest $srcitm.Name); if ($srcitm.PSIsContainer -eq $True) { Sync-FileTimes $srcitm.FullName $destitmpath } else { # Check if dest file exists if ((Test-Path $destitmpath) -eq $False) { Write-Error ("Destination item not found {0}" -f $destitmpath) continue; } # Compare times $destitm = Get-Item -Path $destitmpath; if ($srcitm.CreationTime -ne $destitm.CreationTime) { $destitm.CreationTime = $srcitm.CreationTime; } if ($srcitm.LastAccessTime -ne $destitm.LastAccessTime) { $destitm.LastAccessTime = $srcitm.LastAccessTime; } if ($srcitm.LastWriteTime -ne $destitm.LastWriteTime) { $destitm.LastWriteTime = $srcitm.LastWriteTime; } } } } Sync-FileTimes $src $dest |