Skip to content

Instantly share code, notes, and snippets.

@hlsupe
hlsupe / SqlDbaDbeCommands.md
Last active September 26, 2019 14:21
SQL Server Database Admin Engineering commands

List all Sql Agent Jobs with their schedules

use msdb;
go
declare @weekDay table
    (
        mask      int,
        maskValue varchar(32)
    );
@hlsupe
hlsupe / GitTricks.md
Last active December 31, 2019 17:20
Git Tricks

Git Tricks

Creating command aliases

If you have trouble remembering git commands or if you are tired of typing (searching for) the repository link, define aliases.

alias gclone='git clone https://github.com/yourFavoriteRepository'
alias gshowclean='git clean -nfd'
alias gclean='git reset --hard;git clean -fd'

and add to ~/.bash_profile, if you run git bash.

@hlsupe
hlsupe / RegularExpressionsCheetSheet.md
Last active August 27, 2019 16:05
Regular Expressions CheetSheet

Regular Expressions Cheetsheet

Look ups

Look ahead positive A(?=B) Find expression A where expression B follows.
Look ahead negative A(?!B) Find expression A where expression B does not follow.
Look behind positive (?<=B)A Find expression A where expression B precedes.
Look behind negative (?<!B)A Find expression A where expression B does not precede.

@hlsupe
hlsupe / TSQL-Calculating-Running-Totals.md
Last active August 27, 2019 00:37
TSQL - Calculating Running Totals

Running Total

This is an abstract version of a problem I ran into once.

I have this table which stores containers by region and the number of coffee pouches in each of the containers.

if object_id( 'dbo.Container' ) is not null
    drop table dbo.Container
go
@hlsupe
hlsupe / PowerShell-Script-to-Setup-Registered-Servers-on-SQL-Server.md
Created August 27, 2019 00:33
PowerShell Script to Setup Registered Servers on SQL Server

What are Registered Servers?

Refer to Register Servers to get familiar with registered servers.

What does the script do?

Creates a registered servers group as

	Dev
		ProductCatalog

FulfillmentCenter

@hlsupe
hlsupe / BashCommands.md
Last active November 25, 2019 15:00
Bash Commands

Bash Commands

Some of my grep, sed, find and file commands. These are from my personal use and are not supposed to serve as an exhaustive reference.

grep

  1. Find files where lines contain this but not that

    grep --include \*.txt -ri . -P -e '^((?!that).)*this((?!that).)*$'