Skip to content

Instantly share code, notes, and snippets.

@NReilingh
NReilingh / sorenson_dice.sql
Last active January 2, 2023 21:13
Sorenson-dice coefficient in a set-based style. Note -- this is an excerpt and probably does not compile, but may be adapted to your use case. This example is implemented in T-SQL (MS SQL Server)
SET ANSI_NULLS, QUOTED_IDENTIFIER ON;
GO
/***********************************************************************************************************************
Author: Nick Reilingh, Fisher Center at Bard College
Description: Preload for sorensen_dice coefficient word pairs on names.
Notes:
- This procedure is called from LP_FZM_PRELOAD, which supplies it with a dataset_no parameter
- It is supplied with dataset parameter from this procedure.
@NReilingh
NReilingh / SerializationTest.ps1
Last active September 23, 2019 02:35
DSC Configuration data serialized to clixml and then rehydrated doesn't pass this test in PSDesiredStateConfiguration.psm1:1766
$ConfigDataToSerialize = @{
AllNodes = @(
@{
NodeName = 'TestNode1'
}
@{
NodeName = 'TestNode2'
}
)
}
@NReilingh
NReilingh / TestConfig.ps1
Last active September 24, 2019 06:45
DSC Script Resource $using:Key bug
Configuration TestConfig
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
$Key = "My Value"
Node localhost
{
Script TestScript
{
@NReilingh
NReilingh / Script DB to Files.ps1
Created February 9, 2018 17:16
Using SQL SMO in PowerShell to script SQL Server objects
Add-Type -Path 'C:\Program Files\Microsoft SQL Server\140\SDK\Assemblies\Microsoft.SqlServer.Smo.dll'
$SmoServer = New-Object ('Microsoft.SqlServer.Management.Smo.Server') -argumentlist 'localhost'
$SmoServer.ConnectionContext.LoginSecure = $false
$SmoServer.ConnectionContext.set_Login("sa")
$SmoServer.ConnectionContext.set_Password("Passw0rd!")
$db = $SmoServer.Databases['msdb']
$Objects = $db.Tables
@NReilingh
NReilingh / BuildHelper.exe-Documentation.md
Last active July 14, 2016 00:15
Documentation for BuildHelper.exe, a simple tool for concatenating files, specifically written for SQL Server projects.

Sebastian Meine (@sqlity) created BuildHelper.exe as a component of a build process for T-SQL scripts in a SQL Server Management Studio (SSMS) project. This tool is made available as part of the build system for the tSQLt project, and can be downloaded here:

https://github.com/tSQLt-org/tSQLt/blob/master/Build/BuildHelper.exe

Example Use Case

An example build and deploy process would involve kicking off a batch file from SSMS, which would trigger BuildHelper.exe with a designated set of arguments. BuildHelper would output a single .sql file from all of your scripts, which could then be run by your batch file using an invocation of sqlcmd.

Usage

/* This bookmarklet tries to find the first selected link and opens the QR code. When no link is selected the current URL is used. */
javascript:(function(){%20function%20openqr(url){window.open('http://api.qrserver.com/v1/create-qr-code/?data='+encodeURIComponent(url)+'&size=700x700&qzone=6');}%20var%20selected,dl,i;%20dl%20=%20document.links;%20if%20(window.getSelection%20&&%20window.getSelection().containsNode)%20{%20/*%20mozilla%20*/%20for(i=0;%20i<dl.length;%20++i)%20{%20if%20(window.getSelection().containsNode(dl[i],%20true))%20{%20selected%20=%20true;%20openqr(dl[i].href);%20break;%20}%20}%20}%20if%20(!selected)%20{%20/*ie,%20or%20mozilla%20with%20no%20links%20selected%20*/%20openqr(document.URL);%20}%20})();
/* This bookmarklet uses the current URL. On some pages the above bookmarklet doesn't work/always uses an unwanted URL. If you experience this issue or don't need selected links try this one. */
javascript:(function(){window.open('http://api.qrserver.com/v1/create-qr-code/?data='+encodeURICompo