Skip to content

Instantly share code, notes, and snippets.

public static class Util
{
public static string RemoveAcentos(string palavra)
{
string palavraSemAcento = null;
string caracterComAcento = "áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ";
string caracterSemAcento = "aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC";
for (int i = 0; i < palavra.Length; i++)
/****** Object: UserDefinedFunction [dbo].[UperFirst] Script Date: 10/30/2012 15:27:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
public string GetHashFromFile(string localDoArquivo)
{
using (HashAlgorithm hashAlgorithm = HashAlgorithm.Create("SHA1"))
{
using (Stream stream = new FileStream(localDoArquivo, FileMode.Open, FileAccess.Read))
{
byte[] hash = hashAlgorithm.ComputeHash(stream);
return BitConverter.ToString(hash);
}
}
@rodolfofadino
rodolfofadino / space.sql
Created February 4, 2013 11:13
SPACE Table
use DBNAME
go
declare @id int -- The object id that takes up space
,@type character(2) -- The object type.
,@pages bigint -- Working variable for size calc.
,@dbname sysname
,@dbsize bigint
,@logsize bigint
,@reservedpages bigint
@rodolfofadino
rodolfofadino / spaceused_all_tables_in_db.sql
Last active October 10, 2017 01:01
SpaceUsed All Tables
SELECT
o.name as 'TableName' ,
SUM (
CASE
WHEN (index_id < 2) THEN row_count
ELSE 0
END
) as 'RowCount',
LTRIM (STR (SUM (reserved_page_count)/1024 * 8, 15, 0) + ' MB') as'Reserved MB',
@rodolfofadino
rodolfofadino / queryexecutioncount.sql
Created March 19, 2013 16:13
query execution count
--DBCC TRACEON(8666)
--GO
SELECT qt.text [Comando],
CP.usecounts [Qtd Executado],
cp.size_in_bytes [TamanhoBytes],
cp.objtype [TipoConsulta],
qp.query_plan [ExecutionPlan]
FROM sys.dm_exec_cached_plans cp
CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle) qp
using Microsoft.Web.Deployment;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DemoDeploy
{
class Program
{
@rodolfofadino
rodolfofadino / netsh-config
Created August 11, 2013 23:12
Network Configuration on Windows Server
netsh interface ip set address name="Local Area Connection" static ipadress networkmask gatewaydefault 1
netsh interface ip set dnsserver name="Local Area Connection" static xxx.xxx.xxx.xxx
@rodolfofadino
rodolfofadino / homecontroller.cs
Created August 15, 2013 02:20
Exemplo ActionResult JavaScript (MVC2,3,4,5)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcApplication1.Controllers
{
[HandleError]
public class HomeController : Controller
@rodolfofadino
rodolfofadino / createuser.bat
Last active December 21, 2015 12:38
criar usuário, configurar a expiração da senha e adicionar ao groupo de adminsitradores
net user usuarionome senhaa /add
net user usuarionome senhaa
WMIC USERACCOUNT WHERE "Name='usuarionome'" SET PasswordExpires=FALSE
net localgroup administrators usuarionome /add