Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Robson Alves robsonalves

🎯
Focusing
Block or report user

Report or block robsonalves

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
@robsonalves
robsonalves / triangulo2.cs
Last active Jun 25, 2019 — forked from celiosouza2013/triangulo2.cs
Execício área triangulo utilizando classes, atributos e métodos
View triangulo2.cs
//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 / migratingRepo.sh
Created Apr 5, 2019
Script to migrate Repostories Git on DevOpsAzure - Including All Branches
View migratingRepo.sh
#!/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 / sh
Created Oct 30, 2018
Create a partiton file
View sh
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 / FTPConfig.ps1
Created May 12, 2017
Config FTP windows server via PS
View FTPConfig.ps1
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 / gist:2d04495807c667c287cb
Last active Feb 23, 2016
Detach and attach via CMD
View gist:2d04495807c667c287cb
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 / gist:eb82c0c4ee56d661e441
Created Feb 23, 2016
SQL Server - Querys Pesadas
View gist:eb82c0c4ee56d661e441
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 / rebuildALLIndex.sql
Last active Oct 23, 2015
Rebuild all indexes to change fill factor
View rebuildALLIndex.sql
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 / indexmissingListIndex.sql
Created Oct 21, 2015
Returning Index Missing and List of Idexes
View indexmissingListIndex.sql
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
View Remover All Columns.sql
declare @query varchar(max) = ''
DECLARE @Remove nvarchar(1000)
select 'ALTER TABLE '+ a.name + ' drop column ' + b.name + '' as Remove
into #temp
from sys.tables a
inner join sys.columns b on b.object_id = a.object_id
where b.name like '%ROW%'
@robsonalves
robsonalves / indiceseconversao.sql
Last active Oct 21, 2015
Encontrar Falta de Indices e Conversão Implicita
View indiceseconversao.sql
SET TRANSACTION isolation level READ uncommitted
SELECT TOP 20 ST.text AS [PARENT QUERY],
Db_name(ST.dbid) AS [ DATABASENAME ],
CP.usecounts AS [USAGE COUNT],
QP.query_plan
FROM sys.dm_exec_cached_plans CP
CROSS apply sys.Dm_exec_sql_text(CP.plan_handle) ST
CROSS apply sys.Dm_exec_query_plan(CP.plan_handle) QP
WHERE Cast(QP.query_plan AS NVARCHAR(max)) LIKE '%<MissingIndexes>%' or
You can’t perform that action at this time.