Skip to content

Instantly share code, notes, and snippets.

View robsonalves's full-sized avatar
🏠
Working from home

Robson Alves robsonalves

🏠
Working from home
View GitHub Profile
@robsonalves
robsonalves / indexmissingListIndex.sql
Created October 21, 2015 18:40
Returning Index Missing and List of Idexes
set transaction isolation level read uncommitted
select DB_NAME(database_id) as DataBaseName
, count(*) as [Missing Index Count]
from sys.dm_db_missing_index_details
group by db_name(database_id)
order by [Missing Index Count] desc
@robsonalves
robsonalves / rebuildALLIndex.sql
Last active October 23, 2015 17:05
Rebuild all indexes to change fill factor
DECLARE @TableName VARCHAR(255)
DECLARE @sql NVARCHAR(500)
DECLARE @fillfactor INT
SET @fillfactor = 80
DECLARE TableCursor CURSOR FOR
SELECT OBJECT_SCHEMA_NAME([object_id])+'.'+name AS TableName
FROM sys.tables
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
@robsonalves
robsonalves / gist:eb82c0c4ee56d661e441
Created February 23, 2016 11:13
SQL Server - Querys Pesadas
use [database]
go
select total_worker_time/execution_count as MediaCPU
, total_worker_time AS TotalCPU
, total_elapsed_time/execution_count as MediaDuration
, total_elapsed_time AS TotalDuration
, total_logical_reads/execution_count as MediaLogicalReads
, total_logical_reads AS TotalLogicalReads
, total_physical_reads/execution_count as MediaPhysicalReads
, total_physical_reads AS TotalPhysicalReads
@robsonalves
robsonalves / gist:2d04495807c667c287cb
Last active February 23, 2016 18:11
Detach and attach via CMD
USE MASTER;
GO
-- Take database in single user mode -- if you are facing errors
-- This may terminate your active transactions for database
ALTER DATABASE Piloto
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
-- Detach DB
EXEC MASTER.dbo.sp_detach_db @dbname = N'Piloto'
@robsonalves
robsonalves / FTPConfig.ps1
Created May 12, 2017 13:16
Config FTP windows server via PS
Import-module servermanager
Add-WindowsFeature web-server –includeallsubfeature
Import-Module WebAdministration
New-WebFtpSite -Name "LinxFTP" -Port "21" -Force
cmd /c \Windows\System32\inetsrv\appcmd set SITE "LinxFTP" "-virtualDirectoryDefaults.physicalPath:C:\inetpub\ftproot"
Set-ItemProperty "IIS:\Sites\LinxFTP" -Name ftpServer.security.ssl.controlChannelPolicy -Value 0
@robsonalves
robsonalves / sh
Created October 30, 2018 23:04
Create a partiton file
tail -n +2 YOURFILE.csv/txt | split -l 1000 -d --additional-suffix=.csv - split_
for file in split_*
do
head -n 1 YOURFILE.csv/txt > tmp_file
cat $file >> tmp_file
mv -f tmp_file $file
done
@robsonalves
robsonalves / migratingRepo.sh
Created April 5, 2019 10:07
Script to migrate Repostories Git on DevOpsAzure - Including All Branches
#!/bin/bash
clear
REPOS=(teste teste1 teste2)
git=https://user:password@{organizationName}.visualstudio.com/{TeamProject}/_git/
newRepo=https://user:password@{organizationName}.visualstudio.com/{TeamProject}/_git/
for i in ${REPOS[@]}
do
echo $git$i
@robsonalves
robsonalves / triangulo2.cs
Last active June 25, 2019 21:06 — forked from celiosouza2013/triangulo2.cs
Execício área triangulo utilizando classes, atributos e métodos
//Criando Classe
using System;
namespace Course
{
class Triangulo
{
private double A { get; set; }
private double B { get; set; }
private double C { get; set; }
@robsonalves
robsonalves / gist:d5828239ab83f6849c1fb77c99e091af
Created April 13, 2020 17:33
CURL to Mensure ResponseTime
curl 'https://{{YOUR_WEB_SITE}}/' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,ja;q=0.6' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36' -H 'Connection: keep-alive' --compressed -s -o /dev/null -w "%{time_starttransfer}\n"
@robsonalves
robsonalves / main.cs
Last active May 1, 2020 06:12
Infix to Postfix
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
//Console.Write("Infix Formule: ");
//string infix = Console.ReadLine();
string infix = "4.5+a5+.1215 + 1";