This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
process.env.AWS_SDK_LOAD_CONFIG = true; | |
process.env.AWS_PROFILE = "development"; | |
const AWS = require('AWS-SDK'); | |
AWS.config.update( { region: "us-west-2"} ); | |
const ddbc = new AWS.DynamoDB.DocumentClient(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
let today = new Date(); | |
today.setDate(today.getDate() + 100); | |
console.log(today.toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CAST(record as xml).value('(/Record/@id)[1]', 'int') AS [RecordID] | |
, CAST(record as xml).value('(/Record/ConnectivityTraceRecord/RecordTime)[1]', 'datetime') AS [RecordTime] | |
, CAST(record as xml).value('(/Record/ConnectivityTraceRecord/RecordType)[1]', 'varchar(max)') AS [RecordType] | |
, CAST(record as xml).value('(/Record/ConnectivityTraceRecord/Spid)[1]', 'varchar(max)') AS [SPID] | |
, CAST(record as xml).value('(/Record/ConnectivityTraceRecord/RemoteHost)[1]', 'varchar(max)') AS [RemoteHost] | |
, CAST(record as xml).value('(/Record/ConnectivityTraceRecord/RemotePort)[1]', 'int') AS [RemotePort] | |
, CAST(record as xml).value('(/Record/ConnectivityTraceRecord/SniConsumerError)[1]', 'smallint') AS [ErrorNumber] | |
, CAST(record as xml).value('(/Record/ConnectivityTraceRecord/State)[1]', 'tinyint') AS [ErrorState] | |
, CAST(record AS XML) AS [msg] | |
FROM sys.dm_os_ring_buffers rbuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Synopsis | |
Test Connectivity to SQL Server Instance | |
.Description | |
This script tests connectivity to a SQL Server instance. The script attempts to connect to an instance from it's host machine at a specified interval over a specified period. | |
.Parameter InstanceName | |
The name or IP address of the instance you're testing connectivity of. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---Create a playground | |
create database sandbox; | |
go | |
use sandbox | |
go | |
drop table dbo.tableOfThings | |
go | |
create table dbo.tableOfThings ( | |
id int identity(1,1) not null constraint pk_tableOfThings primary key | |
, date_created datetime2 not null constraint df_date_created default getdate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fuzzywuzzy import fuzz | |
import pandas as pd | |
path_employee_list = "C:/Users/adam.fortuno/temp/employee_names.txt" | |
path_ad_users_list = "C:/Users/adam.fortuno/temp/ad-user-names.txt" | |
path_employee_to_aduser_mapping = "C:/Users/adam.fortuno/temp/mapping.csv" | |
employee_mapping = [] | |
with open(path_employee_list, "r") as employee: | |
for employee_name in employee: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Connect to an instance | |
[void][Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | |
$instance = New-Object 'Microsoft.SqlServer.Management.Smo.Server' -ArgumentList '<instanceName>' | |
## Connect to an innstance's WMI | |
[void][Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | |
[void][Reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | |
$instance_wmi = New-Object 'Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer' -ArgumentList '<instanceName>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$servers = @( | |
'foo1.sandbox.local' | |
'foo2.sandbox.local' | |
'foo3.sandbox.local' | |
) | |
foreach ($server in $servers) { | |
"{0}`t{1}" -f $server, [System.Net.Dns]::GetHostAddresses($server).IPAddressToString | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
Situation... | |
There is a DOS batch script named foo.bat in C:\temp\foo.bat. We want | |
******************************************************************************/ | |
$things-todo-when-batchfile-completes = { | |
new-item 'c:\temp\thinger-done.txt' | |
Get-EventSubscriber | Unregister-Event | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Secure message transmission with TLS 1.2 (default is 1.0) | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Send-Mailmessage -smtpServer ... -Port ... -from "me@home.com" -to "you@home.com" -subject "..." -body "..." |