Skip to content

Instantly share code, notes, and snippets.

Amit Choudhary vendettamit

Block or report user

Report or block vendettamit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vendettamit
vendettamit / InvokeRemoteProcess.cs
Created May 12, 2016
WMI Snippet to invoke a process on remote machine with privileges.
View InvokeRemoteProcess.cs
ConnectionOptions connection = new ConnectionOptions() {
EnablePrivileges = true
};
connection.Username = "achoudhary";
connection.Password = "ggn@1212";
connection.Authority = "ntlmdomain:health";
ManagementScope scope = new ManagementScope(
"\\\\7vmdev038\\root\\CIMV2", connection);
scope.Connect();
@vendettamit
vendettamit / MS-TestResult-XSL2.0.xsl
Created May 6, 2016
xml stylesheet to transform MS Coded UI test results to html with xslt 2.0
View MS-TestResult-XSL2.0.xsl
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xp="http://www.xmlprime.com/"
xmlns:ext="urn:extensions">
<xsl:output method="html" />
<xsl:param name="applicationPath" select="'.'" />
<xsl:template match="/">
<script language="javascript">
function toggle (name, spn)
@vendettamit
vendettamit / MS-TestResult-XSL1.0.xsl
Created May 6, 2016
xml stylesheet to transform MS Coded UI test results to html with xslt 1.0
View MS-TestResult-XSL1.0.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xp="http://www.xmlprime.com/"
xmlns:ext="urn:extensions">
<xsl:output method="html" />
<xsl:param name="applicationPath" select="'.'" />
<xsl:key name="groups" match="result" use="testCaseStatus"/>
<xsl:template match="/">
@vendettamit
vendettamit / UnitOfWorkFactory.tt
Created May 2, 2016
A T4Template to auto generate Unit of work factory over repository pattern (Entity framework)
View UnitOfWorkFactory.tt
<#@ template debug="true" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Core.dll" #>
<#@ Assembly Name="System.Xml.dll" #>
<#@ Assembly Name="System.Xml.Linq.dll" #>
<#@ Assembly Name="System.Windows.Forms.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
@vendettamit
vendettamit / IdentitySeed.sql
Created Apr 5, 2016
Demo scripts replicating the scenario where Trunc would reset the Reseeded identity column in existing table
View IdentitySeed.sql
USE [YourDb]
GO
-- Create Table
CREATE TABLE [dbo].[TestTable](
[ID] [int] IDENTITY(11,1) NOT NULL,
[Var] [nchar](10) NULL,
[Dated] DateTime default CURRENT_TIMESTAMP
) ON [PRIMARY]
GO
@vendettamit
vendettamit / Trigger.js
Last active Feb 23, 2016
Change default onfocusout and trigger validation for individual form elements while user starts typing in input fields
View Trigger.js
$(document).ready(function () {
var $validatr = $('form').data('validator');
var settngs = $validatr.settings;
settngs.onkeyup = function (element, eventType) {
if (!$validatr.element(element))
{
$(this.currentForm).triggerHandler("invalid-form", [this]);
}
};
@vendettamit
vendettamit / DynamicLinqCSharp.cs
Created Feb 19, 2016
A dynamic linq class library source code. Download the original content from here - http://www.scottgu.com/blogposts/dynquery/dynamiclinqcsharp.zip
View DynamicLinqCSharp.cs
//Copyright (C) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
@vendettamit
vendettamit / TfvcTemplate.12.WithChaining.xaml
Created Feb 18, 2016 — forked from jstangroome/TfvcTemplate.12.WithChaining.xaml
The Team Build 2013 default process template for TFVC with support for queuing additional builds on success and passing parameters. http://blog.stangroome.com/2014/02/19/queue-a-team-build-from-another-and-pass-parameters/
View TfvcTemplate.12.WithChaining.xaml
<Activity x:Class="TfsBuild.Process" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mt="clr-namespace:Microsoft.TeamFoundation;assembly=Microsoft.TeamFoundation.Common" xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client" xmlns:mtbco="clr-namespace:Microsoft.TeamFoundation.Build.Common;assembly=Microsoft.TeamFoundation.Build.Common" xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtba="clr-namespace:Microsoft.TeamFoundation.Build.Activities;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbac="clr-namespace:Microsoft.TeamFoundation.Build.Activities.Core;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbag="clr-namespace:Microsoft.TeamFound
View ExpensiveSqlLoggerInterceptor.cs
public class ExpensiveSqlLoggerInterceptor : DbCommandInterceptor
{
private readonly IQueryLogger _queryLogger;
private readonly int _executionMillisecondThreshold;
private readonly bool _includeStackTrace;
public ExpensiveSqlLoggerInterceptor(IQueryLogger logger, int executionMillisecondThreshold, bool enableStackTrace = true)
{
_queryLogger = logger;
_executionMillisecondThreshold = executionMillisecondThreshold;
View GroupByPOC.cs
public class Program
{
class TeamHistory
{
public DateTime Date { get; set; }
public string Event { get; set; }
public string TeamName { get; set; }
You can’t perform that action at this time.