Skip to content

Instantly share code, notes, and snippets.

View jacobhackl's full-sized avatar

Jacob Hackl jacobhackl

  • minneapolis, mn
View GitHub Profile
@jacobhackl
jacobhackl / gist:7e59719adb4128ef831e
Created August 24, 2015 18:04
SQL delete for duplicates using WITH
;WITH cte
AS (SELECT ROW_NUMBER() OVER (PARTITION BY Col1, Col2, Col3
ORDER BY ( SELECT 0)) RN
FROM #MyTable)
DELETE FROM cte
WHERE RN > 1
@jacobhackl
jacobhackl / gist:a0d556f0acebc1bae527
Created June 12, 2015 13:37
delete aged files on windows
forfiles /p D:\wrx\data\iedi\done /s /m *.* /d -180 /c "cmd /c del @path"
@jacobhackl
jacobhackl / gist:21ab1c08e3310ac35eed
Created February 27, 2015 15:20
svn ignore for windows
*.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store thumbs.db Thumbs.db *.bak *.class *.exe *.dll *.mine *.obj *.ncb *.lib *.log *.idb *.pdb *.ilk *.msi* .res *.pch *.suo *.exp *.*~ *.~* ~*.* cvs CVS .CVS .cvs release Release debug Debug ignore Ignore bin Bin obj Obj *.csproj.user *.user *.generated.cs
@jacobhackl
jacobhackl / gist:6922bcde095d147d2fe5
Created November 20, 2014 23:01
Search SQL objects for a column
-- Search in All Objects
SELECT OBJECT_NAME(OBJECT_ID),
definition
FROM sys.sql_modules
WHERE definition LIKE '%' + 'CreatedDate' + '%'
GO
-- Search in Stored Procedure Only
SELECT DISTINCT OBJECT_NAME(OBJECT_ID),
object_definition(OBJECT_ID)
@jacobhackl
jacobhackl / assemblyinfo.cs
Created November 14, 2014 14:59
Improve cross language .net compatability
[assembly: CLSCompliant(true)]
@jacobhackl
jacobhackl / batched deletes
Created October 17, 2014 15:25
SQL - batched deletes
-- Step 1 : Declare the varaibles
use Northwind
Declare @counter int
Declare @RowsEffected int
Declare @RowsCnt int
Declare @CodeId int
Declare @OldCodeId int
Declare @Err int
SELECT @COUNTER = 1
@jacobhackl
jacobhackl / gist:1715968cdab7c40a57e7
Created September 23, 2014 17:22
couchbase transfer
work in progress
cbtransfer http://192.168.2.91:8091 http://192.168.2.18:8091 -b bucket -B buckett -u Admin -p pw -n
@jacobhackl
jacobhackl / gist:10490973
Created April 11, 2014 18:39
Simple deployment script - windows
REM "press any key to continue with deploy. This will backup current IIS set and move the site from deploy into its place. Hit the X to cancel"
PAUSE
for /f "skip=1" %%d in ('wmic os get localdatetime') do if not defined mydate set mydate=%%d
SET source=C:\inetpub\wwwroot\SetSight3
SET destination=C:\Code\Deploy\Archive\SetSight3_%mydate:~0,8%
REM use Robocopy %source% %destination% /S /MOV /XF web.config /MAX:100000 to ignore web.config
Robocopy %source% %destination% /S /MOVE /XF serverInfo.js web.config /MAX:100000
SET source=C:\Code\Deploy\SetSight3
SET destination=C:\inetpub\wwwroot\SetSight3
Robocopy %source% %destination% /S /XF serverInfo.js web.config /MAX:100000
install-package newtonsoft.json -version 5.0.8
@jacobhackl
jacobhackl / gist:5454726
Created April 24, 2013 19:11
Quick Linq to SQL query for element with a namespace
XElement pop = XElement.Parse(xml);
XNamespace ns = "mtvnCWExternInteropResData";
string result = pop.Descendants(ns + "RedirInfo").First().Value;