Skip to content

Instantly share code, notes, and snippets.

@LSTANCZYK
LSTANCZYK / TSQL-to-POCO
Created February 12, 2019 16:30 — forked from joey-qc/TSQL-to-POCO
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@LSTANCZYK
LSTANCZYK / Aggregate_Concatenate.sql
Created November 6, 2018 23:39 — forked from FilipDeVos/Aggregate_Concatenate.sql
SQL Server Aggregate to concatenate strings
-- This script deploys the dbo.Concatenate() aggregate function on SQL Server. This is compiled from the code Concatenate.cs below.
CREATE ASSEMBLY [concat]
FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C010300E3EE2A540000000000000000E00002210B010B00000C00000006000000000000AE2B0000002000000040000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000602B00004B000000004000009003000000000000000000000000000000000000006000000C000000282A00001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000B40B000000200000000C000000020000000000000000000000000000200000602E7273726300000090030000004
@LSTANCZYK
LSTANCZYK / SQL_CLR_Functions-NETCLR40.sql
Created November 6, 2018 23:38 — forked from martijnburgers/SQL_CLR_Functions-NETCLR40.sql
SQL CLR Functions for converting bytes to UTF-7, UTF-8, UTF32 and Unicode. Build for SQL Server 2012 and 2014.
GO
PRINT N'Creating [SQL_CLR_Functions]...for SQL Server 2012 and 2014.';
GO
CREATE ASSEMBLY [SQL_CLR_Functions]
AUTHORIZATION [dbo]
FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C01030041212C550000000000000000E00002210B010B000008000000060000000000002E270000002000000040000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000D42600005700000000400000C802000000000000000000000000000000000000006000000C0000009C2500001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E7465787400000034070000002000000008000000020000000000000000000000000000200000602E72737263000000C8020000004000000004000000
@LSTANCZYK
LSTANCZYK / HtmlDecode.sql
Created October 25, 2018 20:49 — forked from azborgonovo/HtmlDecode.sql
HtmlDecode in SQL
CREATE FUNCTION [dbo].[udf_HTMLDecode] (@text NVARCHAR(MAX))
RETURNS NVARCHAR(MAX) AS
BEGIN
DECLARE @vcResult NVARCHAR(MAX)
DECLARE @vcCrLf NVARCHAR(2)
DECLARE @siPos SMALLINT
DECLARE @vcEncoded NVARCHAR(7)
DECLARE @siChar SMALLINT
SET @vcCrLF = CHAR(13) + CHAR(10)
@LSTANCZYK
LSTANCZYK / CronTab-Expander.sql
Created October 25, 2018 20:02 — forked from manfredk/CronTab-Expander.sql
Expand CronTab expressions with SQL / T-SQL
USE Exercises
GO
/* ***********************************************************************************************
*
* CRONTAB EXPANDER
*
* ***********************************************************************************************/
/**************************************************************************************************
@LSTANCZYK
LSTANCZYK / SQLDateSnippets.sql
Created October 18, 2018 18:24 — forked from Dynyx/SQLDateSnippets.sql
Handy SQL date snippets
---Today
SELECT GETDATE() 'Today'
----Yesterday
SELECT DATEADD(d,-1,GETDATE()) 'Yesterday'
----First Day of Current Week
SELECT DATEADD(wk,DATEDIFF(wk,0,GETDATE()),0) 'First Day of Current Week'
----Last Day of Current Week
using System;
using Microsoft.Owin;
using NLog; // Using NLog in this example
namespace com.github.gist.coenm
{
public static class LogRequestResponseHelper
{
public static void LogDebugResponse(Logger logger, IOwinResponse response)
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using RestSharp;
using Newtonsoft.Json;
using RestSharp.Deserializers;
Set-ExecutionPolicy Unrestricted -Force
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
disable-uac
disable-microsoftupdate
install-windowsupdate -acceptEULA
Set-TaskbarOptions -Size Small -Lock -Dock Bottom
Enable-RemoteDesktop
Enable-PSRemoting -Force
Set-StartScreenOptions -EnableBootToDesktop -EnableDesktopBackgroundOnStart -EnableShowStartOnActiveScreen -EnableShowAppsViewOnStartScreen -EnableSearchEverywhereInAppsView -EnableListDesktopAppsFirst
@LSTANCZYK
LSTANCZYK / PowerShell Customization.md
Created April 17, 2018 21:06 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.