Skip to content

Instantly share code, notes, and snippets.

@rodolfofadino
rodolfofadino / nrd.ps1
Created August 21, 2014 19:09
Tag Deploy on NewRelic
##usage: newrelicdeploy.ps1 -User Rodolfo -Revision RevisionName -Description Description -Changelog Changes
param([String] $User, [String] $Revision, [String] $Description, [String] $Changelog)
[console]::OutputEncoding = [text.encoding]::UTF8
$appID = "APPID"
$apiKey = "APIKEY"
"Sending deploy to New Relic API..."
$command = "curl -k -H 'x-api-key:$apiKey' -d 'deployment[application_id]=$appID' --data-urlencode 'deployment[description]=$Description' -d 'deployment[revision]=$Revision' -d 'deployment[changelog]=$Changelog' -d 'deployment[user]=$User' https://api.newrelic.com/deployments.xml"
Dcdiag.exe /v >> temppre_dcdiag.txt
#http://technet.microsoft.com/pt-br/library/cc776854(v=ws.10).aspx
@rodolfofadino
rodolfofadino / homecontroller.cs
Created November 25, 2014 16:56
Exemplo de imagem em url com /
using System.IO;
using System.Web.Mvc;
namespace TDCFrontEnd.Controllers
{
public class HomeController : Controller
{
public ActionResult About()
{
//Acesso ao Database
@rodolfofadino
rodolfofadino / gitconfig
Created February 12, 2015 12:46
gitconfig
[user]
name = User
email = [email protected]
[diff]
tool = vsdiffmerge
keepBackup = false
[difftool]
prompt = false
keepBackup = false
@rodolfofadino
rodolfofadino / delefiles.ps1
Last active August 29, 2015 14:15
Delete Older Files
$Now = Get-Date
$Days = "7"
$TargetFolder = "C:\Applications\Logs"
$Extension = "*.log"
$LastWrite = $Now.AddDays(-$Days)
$Files = Get-Childitem $TargetFolder -Include $Extension -Recurse | Where {$_.LastWriteTime -le "$LastWrite"}
foreach ($File in $Files)
@rodolfofadino
rodolfofadino / aspnetconfigurationtool.txt
Created March 27, 2015 13:06
Open ASP.NET Configuration Tool
C:\Program Files\IIS Express>iisexpress.exe /path:C:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/ASP.NETWebAdminFiles" /port:44444 /clr:4.0 /ntlm
http://localhost:44444/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\XXXXX&applicationUrl=/
@rodolfofadino
rodolfofadino / upload_on_thumbor.cs
Created June 17, 2015 22:29
Upload Image on Thumbor with c#
class Program
{
static void Main(string[] args)
{
var httpClient = new HttpClient();
var httpContent = new ByteArrayContent(FileToByteArray(@"C:\deborah-secco.jpg"));
httpContent.Headers.Add("slug", "deborah-secco.jpg");
HttpResponseMessage response = null;
try
@rodolfofadino
rodolfofadino / UploadForm.html
Created June 17, 2015 22:30
Upload image on thumbor with html form
<html>
<head>
</head>
<body>
<form action="http://thumbor-server/image" enctype="multipart/form-data" method="post">
Upload Image:
<input type="file" id="media" name="media" />
<input type="submit" />
</form>
</body>
private static void ExportClientesToSolr(List<Cliente> listaDeClientes)
{
Startup.Init<Cliente>("http://solr-server:8080/solr/solrcluster/");
ISolrOperations<Cliente> solr = ServiceLocator.Current.GetInstance<ISolrOperations<Cliente>>();
var total = listaDeClientes.Count();
var indice = 0;
foreach (var cliente in listaDeClientes)
{
indice++;
@rodolfofadino
rodolfofadino / QueryToFindExecutadedQuery.sql
Created August 24, 2015 20:55
QueryToFindExecutadedQuery.sql
SELECT top 2000 execquery.last_execution_time AS [Date Time], execsql.text AS [Script] FROM sys.dm_exec_query_stats AS execquery
CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql
where execsql.text like '%textoparaprocurar%'
ORDER BY execquery.last_execution_time DESC