Skip to content

Instantly share code, notes, and snippets.

View PRElias's full-sized avatar
🎯
Focusing

Paulo Roberto Elias PRElias

🎯
Focusing
View GitHub Profile
@PRElias
PRElias / sql-drop-all.sql
Created June 13, 2018 19:11
SQL Server Drop All
/* Drop all non-system stored procs */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name])
WHILE @name is not null
BEGIN
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']'
EXEC (@SQL)
@PRElias
PRElias / Dockerfile
Created July 18, 2018 01:21
Dockerfile para configurar um Jenkins com instruções
# Setando a imagem a ser baixada
# https://github.com/jenkinsci/docker
FROM jenkins/jenkins:lts
# Author
LABEL Paulo Roberto Elias "[email protected]"
# Seta o usuário para ficar administrador
USER root
# Atualiza o S.O.
RUN apt-get update
@PRElias
PRElias / Dockerfile
Created July 18, 2018 13:48
Dockerfile para SQL server
# Setando a imagem a ser baixada
# https://hub.docker.com/r/microsoft/mssql-server-linux/
FROM microsoft/mssql-server-linux:latest
# Author
LABEL Paulo Roberto Elias "[email protected]"
# Seta o usuário para ficar administrador
USER root
# Atualiza o S.O.
RUN apt-get update
@PRElias
PRElias / Excel_linked_server.sql
Created July 19, 2018 22:31
Backup não testado de um script para criar um linked server e ler planilhas no SQL Server
/****** Object: LinkedServer [EXCEL] Script Date: 09/06/2013 10:02:20 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'EXCEL', @srvproduct=N'Excel files', @provider=N'ADsDSOObject', @datasrc=N'c:\temp\importacoes.xls', @provstr=N'Excel 8.0'
/* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'EXCEL',@useself=N'False',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'collation compatible', @optvalue=N'false'
GO
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas]
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas\command]
@="powershell.exe \"-Command\" \"if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'\""
@PRElias
PRElias / Instalar.ps1
Last active January 3, 2019 00:03
Script de instalação ou upgrade de softwares padrão
# Configurando
Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
# Instalando Chocolatey
Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Recarregando PATH variables
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
# Instalações fundamentais
@PRElias
PRElias / README_TEMPLATE.md
Last active August 8, 2018 17:51
Template com funcionalidades mais interessantes de arquivos Markdown

Template de recursos markdown / Github.

Clone ou baixe o repositório e verifique o arquivo em seu editor de texto preferido para exibir as sintaxes para cada item desejado.

Listas e links para outros documentos no mesmo repositório

Exibição de GIFs animados de outro repositório (não funciona no GitHub Gist)

SELECT
value
,REPLACE(REPLACE(value, CHAR(13), ''), CHAR(10), '') AS OnlyCharacters
FROM STRING_SPLIT(
'paulo
,roberto
,elias
', ',')
SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.*
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC
@PRElias
PRElias / web.php
Created September 10, 2018 12:16
Laravel log on browser
Route::get('/laravellog', function () {
$file = storage_path() . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . 'laravel.log';
$data = file($file);
$currentLine = count($data) - 1000;
if($currentLine < 0){
$currentLine = 0;
}
while($currentLine <= count($data) - 1){