Skip to content

Instantly share code, notes, and snippets.

View ConstantineK's full-sized avatar
🤖
keeping it real

Constantine ConstantineK

🤖
keeping it real
View GitHub Profile
@ConstantineK
ConstantineK / FeedsUpdate.reg
Created June 8, 2021 15:09
Remove windows new feeds
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds]
"EdgeMUID"="3F61B1E2FEFB605D2878BB1DFFEC6166"
"IsAnaheimEdgeInstalled"=dword:00000001
"osLocale"="en-US"
"IsFeedsAvailable"=dword:00000000
"ShellFeedsTaskbarViewMode"=dword:00000002
"HeadlinesOnboardingComplete"=dword:00000001
@ConstantineK
ConstantineK / test_db_doc.md
Last active August 12, 2020 15:22
testing out sp_doc
@ConstantineK
ConstantineK / replace_commas
Created August 29, 2019 13:33
updating_spaces_in_files
# write what we want, then use it in a loop
function Update-Spaces {
param ($path)
$contents = Get-Content $path
$contents -replace "\s+",", " | Set-Content $path -Force
}
# now say we have multiple files, we need to loop and rewrite
# for each file in the folder that the script provides, filtering files that contain the filter
declare @eva table -- entity value attribute
(
id int identity, -- we could use date here either
type nvarchar(100),
value nvarchar(100),
student_identifier int
)
insert @eva (type, value, student_identifier)
select 'studentid', '1', 3
@ConstantineK
ConstantineK / data_sampler.sql
Last active April 4, 2019 23:33
Take a SQL Server object (view, table), grab its columns, count distinct its values, and return them in descending order of cardinality
CREATE OR ALTER procedure #data_sampler
(
@schema_name NVARCHAR(128) = 'dbo',
@object_name NVARCHAR(128)
)
AS
BEGIN
SET NOCOUNT ON;
DECLARE
@ConstantineK
ConstantineK / example.ipynb
Created March 7, 2019 20:53
my first example tsql notebook in Azure Data Studio
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
SELECT *
FROM
(
SELECT
STUFF((
SELECT '' + comp.entity_data AS [text()]
FROM (
SELECT
DISTINCT
number
@ConstantineK
ConstantineK / mask_string.sql
Created January 9, 2019 00:27
support index based masking strings in TSQL
-- You can either pass a format string, or you could store it in a table per row
-- If you want to support additional cases, just modify the last CROSS APPLY
DECLARE @format_string nvarchar(500) = 'X###XXX###'
SELECT STRING_AGG(result.chars,'') AS strings
FROM sys.objects AS m
CROSS APPLY
(
SELECT
@ConstantineK
ConstantineK / DoesntWorkFully.ps1
Last active November 16, 2017 20:55
first crack at changing collations automatically in sql server
Import-Module dbatools
Set-StrictMode -Version 2
function Get-InsecureCredential {
param ($Username, $Password)
Write-Debug "Get-InsecureCredential."
$SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($Username, $SecurePassword)
return $Credential
}
#
Set-StrictMode -Version 2
$ErrorActionPreference = "Stop"
function Convert-StringToMarkdownTableOfContents {
param ([string]$MarkdownDocument)
$nl = [System.Environment]::NewLine
$TOC = "## Table Of Contents$nl$nl"