Skip to content

Instantly share code, notes, and snippets.

View regisbsb's full-sized avatar

Regis Bittencourt regisbsb

View GitHub Profile
@regisbsb
regisbsb / find last command.sql
Created November 26, 2015 10:44
Shows the last command on connection
SELECT S.spid, login_time, last_batch, status, hostname, program_name, cmd,
(
select text from sys.dm_exec_sql_text(S.sql_handle)
) as last_sql
FROM sys.sysprocesses S
where dbid > 0
and DB_NAME(dbid) = '<my_database_name>'
and loginame = '<my_application_login>'
order by last_batch asc
@regisbsb
regisbsb / .editorconfig
Last active November 25, 2015 16:02 — forked from bapti/.editorconfig
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = crlf
insert_final_newline = true
@regisbsb
regisbsb / rename.ps1
Created October 1, 2015 16:50
PowerShell regex file rename
ls | Rename-Item -NewName {$_ -replace 'Season 2 EP(\d\d) .*.mkv', 'The Simpsons S02E$1.mkv' }
@regisbsb
regisbsb / Topshelf.ExternalAnnotations.xml
Created August 26, 2015 09:43
Reshaper Topshelf external annotations
<?xml version="1.0" encoding="utf-8" ?>
<assembly name="Topshelf">
<member name="M:Topshelf.Logging.LogWriter.LogFormat(Topshelf.Logging.LoggingLevel,System.IFormatProvider,System.String,System.Object[])">
<attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)">
<argument>format</argument>
</attribute>
</member>
<member name="M:Topshelf.Logging.LogWriter.LogFormat(Topshelf.Logging.LoggingLevel,System.String,System.Object[])">
<attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)">
<argument>format</argument>
using System;
// ReSharper disable once CheckNamespace
public static class BrazilTime
{
public static DateTime Now
{
get
{
return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("E. South America Standard Time"));
@regisbsb
regisbsb / migrate_shallow.bat
Last active August 29, 2015 14:05
Migrate GIT shallow to version
git tf clone --version=69919 --shallow http://frg-dun-tfs:8080/tfs/HappyTfs $/SAPI/Main .
git tf pull --rebase --deep
@regisbsb
regisbsb / removepackages.bat
Last active August 29, 2015 14:05
Remove packages folder from history
git filter-branch --index-filter "git rm -r --cached --ignore-unmatch packages/" --prune-empty --tag-name-filter cat -- --all
RESTORE FILELISTONLY
--RESTORE DATABASE test
FROM DISK = 'C:\Users\RegisBenedito\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\LocalSuite\pa_1000ingressos_backup_2014_05_20_040001_9459999.bak'
--WITH MOVE 'pa_1000ingressos.Data' TO 'C:\Users\RegisBenedito\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\LocalSuite\pa_1000ingressos.mdf',
--MOVE 'pa_1000ingressos.Log' TO 'C:\Users\RegisBenedito\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\LocalSuite\pa_1000ingressos.ldf',
--REPLACE;