Skip to content

Instantly share code, notes, and snippets.

View litodam's full-sized avatar

Pablo "Lito" Damiani litodam

  • SOUTHWORKS
  • Buenos Aires, Argentina
  • X @litodam
View GitHub Profile
@litodam
litodam / EnableNuGetPackageRestore.txt
Created July 16, 2012 21:35
Enable NuGetPackageRestore (force consent) within the NuGet.targets file
<!-- Add the following line inside the Target Name='CheckPrerequisites' of the NuGet.targets -->
<SetEnvironmentVariable EnvKey="EnableNuGetPackageRestore" EnvValue="true" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
@litodam
litodam / mklink.cmd
Created July 16, 2012 21:37
Create a symbolic link
@litodam
litodam / QueryStats.sql
Created July 16, 2012 21:38
Retrieve "Query" Stats in SQL Server
-- select * from sys.dm_exec_query_stats
SELECT QS.execution_count,
SUBSTRING(QT.TEXT, QS.statement_start_offset/2 + 1,
(CASE WHEN QS.statement_end_offset = -1 THEN LEN(CONVERT(NVARCHAR(MAX), qt.TEXT)) * 2
ELSE QS.statement_end_offset END - qs.statement_start_offset)/2) AS query_text,
QS.total_elapsed_time, QS.last_elapsed_time, QS.min_elapsed_time, QS.max_elapsed_time,
QS.total_rows, QS.last_rows, QS.min_rows, QS.max_rows,
QS.total_worker_time / QS.execution_count AS avg_cpu_time
FROM sys.dm_exec_query_stats AS QS
@litodam
litodam / .gitignore
Created August 7, 2012 19:45
My .gitignore file
# git-ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
*.o
*.sdf
*.lo
*.la
@litodam
litodam / getSqlDbSize.sql
Created September 14, 2012 19:36
Get SQL DB Size in MB
SELECT SUM(reserved_page_count) * 8.0 / 1024 AS MB
FROM sys.dm_db_partition_stats
@litodam
litodam / HtmlHelper.cs
Created December 14, 2012 20:39
HTML Helper to Sanitize html strings
namespace Helpers
{
using System;
using System.Text.RegularExpressions;
public class HtmlHelper
{
private static Regex tags = new Regex("<[^>]*(>|$)", RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled);
private static Regex whitelist = new Regex(
@litodam
litodam / PushAllBranches.cmd
Last active December 10, 2015 13:09
Git commands
REM git clone repo --mirror first
REM If running this in a batch file, replace %R by %%R
for /F "tokens=1 delims=/" %R in ('git branch') do git push github %R --tags
#NOTE: This script is based on the Microsoft provided guidance example at
# https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/.
Param(
[parameter(Mandatory=$true)]
$serviceName,
[parameter(Mandatory=$true)]
$storageAccountName,
[parameter(Mandatory=$true)]
$storageAccountKey,
// ==UserScript==
// @name GitHub plain issues list
// @namespace some namespace
// @version 0.1
// @description some description
// @match https://github.com/*
// @copyright 2014+, Jorge Rowies
// ==/UserScript==
var htmlList = "";
@litodam
litodam / removeBotCommentsFromGitHubPR.tampermonkey.js
Created November 25, 2014 19:57
Removes 'acomghbot' comments from Pull Request view in GitHub to make it easier to parse the feedback
// ==UserScript==
// @name Remove 'acomghbot' comments from Pull Request view in GitHub
// @namespace http://your.homepage/
// @version 0.1
// @description Removes 'acomghbot' comments from Pull Request view in GitHub to make it easier to parse the feedback
// @author You
// @match https://github.com/Azure/acom/pull/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @grant none
// ==/UserScript==