Skip to content

Instantly share code, notes, and snippets.

View stefanteixeira's full-sized avatar

Stefan Teixeira stefanteixeira

  • Toptal
  • Rio de Janeiro
View GitHub Profile
exports.config = {
framework: 'jasmine2',
specs: ['spec/**/*.js'],
sauceUser: 'seu-usuario',
sauceKey: 'sua-access-key',
multiCapabilities: [{
'name': 'UI Tests',
'browserName': 'chrome',
'version': '46.0',
@stefanteixeira
stefanteixeira / packer-ebs-snapshot-id
Created October 2, 2015 19:48
Get EBS Snapshot ID from a Packer build
packer build -machine-readable packer.json | tee build.log
grep 'Tagging snapshot' build.log | cut -d, -f5 | cut -d: -f3 | grep -o '[^$(printf '\t')].*'
$file = "C:\Path\To\Your\File.zip"
$destination = "C:\DestinationPath"
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::ExtractToDirectory($file, $destination)
@stefanteixeira
stefanteixeira / ZipFolder.ps1
Last active January 20, 2021 04:23
PowerShell script to compress a directory to a .zip file
$source = "C:\Path\To\Directory"
$destination = "C:\Path\To\Zip\file.zip"
If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($Source, $destination)
@stefanteixeira
stefanteixeira / SetAccessRuleOnDirectory.ps1
Last active September 19, 2022 02:07
PowerShell script to add permissions for the MSSQLSERVER user to a directory
New-Item -ItemType Directory -Force -Path C:\Path\To\Directory
$path = "C:\Path\To\Directory"
$Acl = (Get-Item $path).GetAccessControl('Access')
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("NT SERVICE\MSSQLSERVER", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$Acl.SetAccessRule($Ar)
Set-Acl $path $Acl
@stefanteixeira
stefanteixeira / ConfigWinFirewall.ps1
Created August 25, 2015 20:03
PowerShell sample script to configure a Windows firewall rule
New-NetFirewallRule -DisplayName "MSSQL" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow
@stefanteixeira
stefanteixeira / EnableTCPSQLServer.ps1
Created August 25, 2015 20:02
PowerShell script to enable TCP in SQL Server
Import-Module "sqlps"
$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = new-object ($smo + 'Wmi.ManagedComputer').
# List the object properties, including the instance names.
$Wmi
# Enable the TCP protocol on the default instance.
$uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Tcp']"
$Tcp = $wmi.GetSmoObject($uri)
@stefanteixeira
stefanteixeira / setupMixedMode.sql
Last active September 1, 2015 16:58
Script to enable mixed mode authentication in SQL Server
/*
To run the script from the DB machine, use: sqlcmd -S localhost -i C:\Path\To\File\setupMixedMode.sql
*/
USE [master]
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2
GO
@stefanteixeira
stefanteixeira / configIPAll.vbs
Created August 25, 2015 19:59
WMI script to configure IPAll properties for SQL Server TCP Configuration
set wmiComputer = GetObject( _
"winmgmts:" _
& "\\.\root\Microsoft\SqlServer\ComputerManagement12")
set tcpProperties = wmiComputer.ExecQuery( _
"select * from ServerNetworkProtocolProperty " _
& "where InstanceName='MSSQLSERVER' and " _
& "ProtocolName='Tcp' and IPAddressName='IPAll'")
for each tcpProperty in tcpProperties
dim setValueResult, requestedValue
@stefanteixeira
stefanteixeira / configIP1.vbs
Created August 25, 2015 19:58
WMI script to configure IP1 properties for SQL Server TCP Configuration
set wmiComputer = GetObject( _
"winmgmts:" _
& "\\.\root\Microsoft\SqlServer\ComputerManagement12")
set tcpProperties = wmiComputer.ExecQuery( _
"select * from ServerNetworkProtocolProperty " _
& "where InstanceName='MSSQLSERVER' and " _
& "ProtocolName='Tcp' and IPAddressName='IP1'")
for each tcpProperty in tcpProperties
dim setValueResult, requestedValue