Skip to content

Instantly share code, notes, and snippets.

View litodam's full-sized avatar

Pablo "Lito" Damiani litodam

  • SOUTHWORKS
  • Buenos Aires, Argentina
  • X @litodam
View GitHub Profile
@litodam
litodam / addselftosqlsysadmin.cmd
Created February 2, 2012 18:46 — forked from wadewegner/addselftosqlsysadmin.cmd
Script to add the current user to the sysadmin role in SQL Server
@echo off
rem
rem ****************************************************************************
rem
rem Copyright (c) Microsoft Corporation. All rights reserved.
rem This code is licensed under the Microsoft Public License.
rem THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
rem ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
rem IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
rem PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
@litodam
litodam / commandTemplate.cmd
Created April 26, 2012 18:30
Batch CMD file starting point (with check for elevation)
@echo off
setlocal
CD /d "%~dp0"
::Test If script has Admin Privileges/is elevated
REG QUERY "HKU\S-1-5-19"
IF %ERRORLEVEL% NEQ 0 (
ECHO Please run this script as an administrator
pause
EXIT /B 1
@litodam
litodam / script.startingPoint.ps1
Created May 11, 2012 16:02
PS1 script to use a starting point
$scriptDir = (split-path $myinvocation.mycommand.path -parent)
Set-Location $scriptDir
#check if the snapin was registered...
if ((Get-PSSnapin -Registered | ?{$_.Name -eq "MySnapin"}) -eq $null) {
Write-Host "SnapIn not installed." -ForegroundColor Red
return
}
if ((Get-PSSnapin | ?{$_.Name -eq "MySnapin"}) -eq $null) {
@litodam
litodam / makecert-self-signed.cmd
Created May 16, 2012 17:08
Create self-signed cert
REM http://msdn.microsoft.com/en-us/library/windowsazure/gg185932.aspx
REM MakeCert.exe -r -pe -n "CN=<service_namespace_name>.accesscontrol.windows.net" -sky exchange -ss my -len 2048 –e <1 year from today>
MakeCert.exe -r -pe -n "CN=<service_namespace_name>.accesscontrol.windows.net" -sky exchange -ss my -len 2048
@litodam
litodam / launchIE.ps1
Created May 30, 2012 22:26
Launching IE with PowerShell
$navOpenInBackgroundTab = 0x1000;
$ie = new-object -com InternetExplorer.Application
$ie.Navigate2("http://www.microsoft.com");
$ie.Navigate2("http://www.google.com", $navOpenInBackgroundTab);
$ie.Visible = $true;
@litodam
litodam / restartAzureEmulator.ps1
Created June 2, 2012 21:24
Restart Windows Azure Storage & Compute Emulator in PowerShell
write-host "========= Resetting Azure Comoute Emulator & Dev Storage... ========="
$CSRunFile = "C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\csrun.exe"
$DSInitFile = "C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\devstore\DSInit.exe"
& $CSRunFile @("/devstore:shutdown")
& $CSRunFile @("/devfabric:shutdown")
Start-Process $DSInitFile @("/ForceCreate", "/silent") -Wait
& $CSRunFile @("/devfabric:shutdown")
& $CSRunFile @("/devfabric:clean")
& $CSRunFile @("/devfabric:start")
@litodam
litodam / cookiesHelper.js
Last active March 19, 2021 23:38
Cookies Helper in Javascript
function CookiesHelper() {}
// usage
// CookiesHelper.createCookie("myCookieUniqueName", value, 30);
// CookiesHelper.createCookie("myJsonCookieUniqueName", json, 30);
CookiesHelper.createCookie = function(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
@litodam
litodam / runGitCommandRecursively.cmd
Created July 16, 2012 21:26
run git commands for all the repos
@echo off
REM Replace 'git pull –all' with your desired command and run this in the folder where you have all the TK repositories located.
for /f "delims=" %%d in ('dir /ad/b') do if exist %%d\.git (
cd %%d
git pull --all
cd..
)
pause
@litodam
litodam / setIISExpressSSLPort.cmd
Created July 16, 2012 21:30
Configuring IIS Express site with a specific port for SSL binding
@echo off
setlocal
CD /d "%~dp0"
SET SiteName=%1
SET WebSitePath=%2
SET SSLPort=%3
"%ProgramFiles%\IIS Express\appcmd" add site /name:"%SiteName%" /physicalPath:"%WebSitePath%" /bindings:https/*:%SSLPort%:localhost
@litodam
litodam / SetupIIS.cmd
Created July 16, 2012 21:31
Easily setup an IIS Site (end to end: Build proj, setup IIS and AppPool, grant SQL permissions)
@ECHO OFF
setlocal
cd /D %~dp0
SET WebSiteProjectFilePath=%1
SET WebSiteProdPath=C:\inetpub\%2
SET IISAppPool=%2
SET IISBinding=%3
SET IISSiteName=%4
SET SqlServer=%5