Skip to content

Instantly share code, notes, and snippets.

@alatas
alatas / tablemeta.sql
Last active April 27, 2022 21:55 — forked from asears/tablemeta.sql
Create markdown based on table metadata in SQL Server / SQL DW / Azure SQL
WITH c1
AS (SELECT
o.name AS tablename,
c.colid,
CONVERT(varchar(10), c.colid) + '|' + c.name + '|' + t.name + '|' + CONVERT(varchar(10), c.length) + '|' AS markdown
FROM sysobjects o
INNER JOIN syscolumns c
ON c.id = o.id
INNER JOIN systypes t
ON t.xtype = c.xtype
@alatas
alatas / DisableAttachSecurityWarningVS2017.ps1
Created September 25, 2018 15:31
Disable Debugger Attach Security Warning via PowerShell
$reg = Get-ChildItem -Recurse -Name privateregistry.bin -Path $env:LOCALAPPDATA\Microsoft\VisualStudio\
$key = $reg.Substring(0, $reg.Length - 20)
reg load 'HKU\VS2017PrivateRegistry\' "$env:LOCALAPPDATA\Microsoft\VisualStudio\$reg"
New-ItemProperty -Path "HKU:\VS2017PrivateRegistry\Software\Microsoft\VisualStudio\$key\Debugger" -Name DisableAttachSecurityWarning -PropertyType DWORD -Value 1 -Force
[gc]::collect()
reg unload 'HKU\VS2017PrivateRegistry'
@alatas
alatas / 7zipBackup.ps1
Created October 14, 2017 21:39
7Zip Full and Diff Backup Script
function Backup {
param(
[Parameter(Mandatory = $True)][string]$Inputs,
[Parameter(Mandatory = $True)][string]$FullBackup,
[string]$DiffBackup = $null,
[string]$7ZPath = "C:\Program Files\7-Zip\7z.exe",
[string]$UpdateSwitch = "-up0q0r2x2y2z0w2!"
)
if ($DiffBackup -eq $null) {
& $7ZPath a -mhe -ms=off -ssw -mx= -t7z $FullBackup $Inputs
@alatas
alatas / filterbranch.sh
Created February 18, 2017 09:32
filter branch example
echo `git rev-parse HEAD` > .git/info/grafts ; git log --decorate ; rm -R .git/refs/original/ ; git filter-branch -- --all; git push --force
@alatas
alatas / macro.vb
Created December 20, 2016 12:55
auto clear categories on new email / Outlook
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim objNS As Outlook.NameSpace
Dim objEmail As Outlook.MailItem
Dim strIDs() As String
Dim intX As Integer
strIDs = Split(EntryIDCollection, ",")
For intX = 0 To UBound(strIDs)
Set objNS = Application.GetNamespace("MAPI")
@alatas
alatas / gist:a0294e17076f1809c0eb7411b792af2b
Created September 23, 2016 17:45
Twitter Mention Regex
Pattern: (?:\b|\B)@([a-zA-Z0-9_]*[a-zA-Z0-9_]+)\w*
Replace: <a href="https://twitter.com/$1" target="_blank">@$1</a>
@alatas
alatas / gist:fa40eba02240a5b2adca0f5d2eeb79cc
Last active September 23, 2016 17:38
Twitter Hashtag Regex
Pattern: (?:\b|\B)#(\w*[a-zA-Z]+)\w*
Replace: <a href="https://twitter.com/hashtag/$1" target="_blank">#$1</a>
@alatas
alatas / CleanupTempFolder.bat
Created September 8, 2016 15:25
Cleanup Temp Folder
cd %TEMP%
del %TEMP%\*.* /S /Q
rd /S /Q %TEMP%\
@alatas
alatas / CleanupTFS.ps1
Last active September 8, 2016 14:57
Remove TFS related files and unbind solution files from TFS (Powershell)
Get-ChildItem *.vspscc -Recurse | %{Write-Host "Deleting *.vssscc -> "$_.FullName ; Remove-Item $_.FullName -Force};Get-ChildItem *.vssscc -Recurse | %{Write-Host "Deleting *.vspscc -> "$_.FullName ; Remove-Item $_.FullName -Force};Get-ChildItem *.sln -Recurse | %{$name=$_.FullName ; Write-Host "Changing *.sln -> "$name ; Copy-Item $name $name".bak" -Force ; (Get-Content $name -Raw) | %{$_ -replace "(?s)\tGlobalSection\(TeamFoundationVersionControl\).*?EndGlobalSection","" }| Set-Content $name -Encoding UTF8 -Force ; Write-Host "Backup File -> "$name".bak"}