Skip to content

Instantly share code, notes, and snippets.

View SQLvariant's full-sized avatar

Aaron Nelson SQLvariant

View GitHub Profile
@NickCraver
NickCraver / Windows10-Setup.ps1
Last active April 1, 2024 10:52
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@halkyon
halkyon / cleanup-win10.ps1
Last active February 6, 2024 09:09
Cleanup Windows 10 Powershell script
##
## Windows 10 cleanup script.
## Remove dodgy tracking settings, unneeded services, all apps, and optional features that come with Windows 10. Make it more like Windows 7.
## NOTE: this was tested on Creators Update (1703) and Fall Creators Update (1709). Some of this may not work as expected on newer versions.
##
## Instructions
## 1. Run this script (under Powershell as Administrator):
## powershell -ExectionPolicy Bypass .\cleanup-win10.ps1
## 2. Let it run through, you may see a few errors, this is normal
## 3. Reboot
# USE THIS SCRIPT TO UPLOAD LARGE .PBIX FILES TO POWER BI REPORT SERVER
#
# I needed to manually construct the form-data as PowerShell doesn't appear to have full support for
# this yet, though it appears to be coming soon.
#CREDENTIALS
[string]$userName = 'BIWIN\MS'
[string]$userPassword = 'xxxxxxxxxxxxx'
[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: 9ad32074-7adb-4822-a049-93600f966aa9
# Source File: ..\Documents\SAPIEN\Projects\Gui-SSRS-Deploy\Gui-SSRS-Deploy.psproj
#------------------------------------------------------------------------
#region Project Recovery Data (DO NOT MODIFY)
<#RecoveryData:
CAIAAB+LCAAAAAAABACNkV1rgzAUhu8L/Q/ifepHxU6IuVhdyy72QS27Had6HBkxkUTH/PeLU4dl
MHb5JO95XnJCT1ioD9R9Bi2w9cpx6LNW71i032DxBbXhSrJgE1BvhunuwAXeZyyBchv6u4jsoLyQ
6CYMCfhRQpJt7PtVEscACfWm8DQ6tZz7BplPvSXOciVKW+d4yzYzwYTOCSvUKAt8hBpT13VuOy7K
-- TRANSLATE() and STRING_SPLIT() work with SQL Server 2016+, STRING_AGG() with 2017+.
-- language_id=1033 is English (simplified)
SELECT STRING_AGG(REPLACE(TRANSLATE(s.[value] COLLATE database_default, '():.,-/='';', '**********'), '*', ''), ' ')
FROM sys.messages AS msg
CROSS APPLY STRING_SPLIT(msg.[text], ' ') AS s
WHERE msg.language_id=1033
--AND s.[value] COLLATE database_default NOT IN ('the', 'is', 'to', 'not', 'a', 'for', 'in', 'be', 'of', 'or', 'cannot', 'and')
AND s.[value] COLLATE database_default NOT LIKE '%[%@=]%'
GROUP BY msg.message_id
@Jaykul
Jaykul / Measure-CommandEx.ps1
Last active June 22, 2022 05:29
We need a better Measure-Command which can show averages
function Measure-CommandEx {
<#
.SYNOPSIS
A from-scratch approach to timing command execution using Stopwatch
#>
[CmdletBinding()]
param(
# The command to test (accepts value from pipeline)
[Parameter(ValueFromPipeline)]
[ScriptBlock[]]$Command,
@shashank291
shashank291 / stockLotsExport.md
Last active January 5, 2022 14:42
Export Fidelity Stock Lots to TSV file

Description

I used the below script to export my Fidelity share lot information in one file. By default, Fidelity requires going to each individual stock page to get this info which can be painstaking.

Instructions

Fair warning that you should understand the code you're running, and I make no guarantees as to the correctness of the script or the data downloaded, and I assume no liabilities if you decide to run this code. Now that that's out of the way, to get your aggregate share lot information:

Go to your Individual account on Fidelity, under Positions tab, and open the console(Ctrl+Shift+J on most browsers). Then you can run the following script that will gather all your stock lot information and download it in a TSV file. I suggest you read through it and verify it as a common precaution. Here's the script:

const domParser = new DOMParser();

@potatoqualitee
potatoqualitee / scrape.ps1
Last active February 24, 2021 15:22
Scrape All Microsoft Connect Items marked Resolved or Closed
# IE has to be used because of a refresh that Invoke-WebRequest can't handle (think Clicks)
# Add required types
Add-Type -Path C:\Scripts\Scheduled\ClosedAsFixed\HtmlAgilityPack.dll
Add-Type -AssemblyName System.Web
Function Get-Total ($closedorresolved, $bugorsuggestion){
switch ($closedorresolved) {
"Closed" { $status = '3' }
"Resolved" { $status = '2' }
@stummsft
stummsft / Set-SqlTlsCertificate.ps1
Created April 5, 2019 00:00
Programmatically set the TLS certificate to be used by a given SQL Server Instance
function Set-SqlTlsCertificate {
[CmdletBinding(SupportsShouldProcess=$true)]
param (
[Parameter()]
[Alias("CN", "MachineName")]
[String[]]$ComputerName = "localhost",
[Parameter()]
[String[]]$InstanceName,
@AndyCross
AndyCross / BabylonjsVisual.ts
Last active December 6, 2020 02:24
Use BabylonJS in PowerBI
declare module BABYLON {
export class Engine {
constructor(canvas:HTMLElement, antialias:boolean);
runRenderLoop(it:any);
resize();
}
export class Scene {
constructor(engine:Engine);
render();
}