Skip to content

Instantly share code, notes, and snippets.

View regisbsb's full-sized avatar

Regis Bittencourt regisbsb

View GitHub Profile
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;
@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
@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
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 / 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>
@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 / .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 / 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 / EnumName.tt
Last active November 30, 2015 13:53
Generate enum
<#@ template language="C#" debug="true" hostspecific="True" #>
<#@ output extension=".cs"#>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Data" #>
<#@ assembly name="System.Configuration" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
# --- settings ---
$feedUrlBase = "http://go.microsoft.com/fwlink/?LinkID=206669"
# the rest will be params when converting to funclet
$latest = $true
$overwrite = $false
$top = 500 #use $top = $null to grab all
$destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "NuGetLocal"
# --- locals ---
$webClient = New-Object System.Net.WebClient