Skip to content

Instantly share code, notes, and snippets.

View nordineb's full-sized avatar

Nordine Ben Bachir nordineb

  • Bekk
  • Oslo, Norway
View GitHub Profile
; AutoHotkey script, download from:
; http://www.autohotkey.com/
; NOTE: Save this file with Windows line endings i.e. \r\n
;
cmd_line := "C:\bin\cygwin\bin\mintty.exe /bin/zsh --login"
wnd_class := "ahk_class mintty"
#c::
## --------------------------------------------------------------------------------------
##
## This script is used to control how we deploy packages to Windows Azure.
## Orignial script (https://gist.github.com/PaulStovell/5234255) customized for
## Staging-To-Production with VIP swap deployment.
##
## NOTE: the script will only do Staging+VIP swap if $OctopusAzureSlot == "Staging".
## If $OctopusAzureSlot == anything else, the script will deploy directly to that slot
## without any further swapping.
##
@nordineb
nordineb / gist:50b150912d23d80aee3e
Last active May 15, 2022 07:42 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan Developer Preview 2

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@nordineb
nordineb / AddCerts.cmd
Created June 9, 2016 12:39 — forked from mikeblakeuk/AddCerts.cmd
Getting HTTPS to work on TeamCity Agents with a self cert pfx
echo For my cloud agents, I had to get the pfx alias, Import the CARoot.cer, merge the pfx, and then change the password.
echo Based on https://github.com/haron/startssl-java and https://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html
cd %~dp0
set JAVA_HOME=C:\BuildAgent\jre
set KEYTOOL=%JAVA_HOME%\bin\keytool
set KEYSTORE=%JAVA_HOME%\lib\security\cacerts
set PASSWORD=changeit
echo "Importing StartSSL certificates into %KEYSTORE%" > run.log
rem C:\BuildAgent>jre\bin\keytool -list -keystore .\conf\ssl\build.cloudapp.net.pfx -storetype pkcs12
@nordineb
nordineb / Demo-AzureADModuleV2.ps1
Created January 26, 2017 14:54 — forked from craig-martin/Demo-AzureADModuleV2.ps1
Demo-AzureADModuleV2.ps1
### Server management tools preview (next month): https://blogs.technet.microsoft.com/servermanagement/2016/02/09/introducing-server-management-tools/
### View the online docs
start https://docs.microsoft.com/en-us/powershell/azuread/v2/azureactivedirectory
### Find the module
Find-Module AzureAD | Select-Object *
<#
Version Name Repository Description
<#
Script showing how to create a KeyVault vault and enable logging
(GUIDs redacted)
#>
New-AzureRmResourceGroup -Name cmartRG0614 -Location westus
<#
ResourceGroupName : cmartRG0614
Location : westus
ProvisioningState : Succeeded
###
### Without splatting
###
Get-Process -Name dns -ComputerName localhost
###
### With splatting
###
$myparamas = @{
@nordineb
nordineb / Invoke-WebApiWithAadToken.ps1
Created January 26, 2017 14:57 — forked from craig-martin/Invoke-WebApiWithAadToken.ps1
Use PowerShell to Authenticate to AAD Then Call a Web API
### Load ADAL
Add-Type -Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
# Set AAD client ID for the client app
$clientId = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
$resourceAppIdURI = "https://TestWebApi01.azurewebsites.net"
$authority = "https://login.windows.net/MyAadDirectory.onmicrosoft.com"
# Create Authentication Context tied to Azure AD Tenant
$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
@nordineb
nordineb / New-SelfSignedCert.ps1
Created January 26, 2017 14:57 — forked from craig-martin/New-SelfSignedCert.ps1
Create a Self-Signed Cert with PowerShell
#Create the cert
New-SelfSignedCertificate -DnsName 'foo.azurewebsites.net' -CertStoreLocation cert:\CurrentUser\My -KeyAlgorithm RSA -KeyLength 2048 -KeyExportPolicy Exportable #-KeyUsage DigitalSignature,nonRepudiation,keyEncipherment
#Look for the cert
dir Cert:\CurrentUser\My
#Export the cert to a PFX file
$mypwd = ConvertTo-SecureString -String "WhoFedTheDogCorn?" -Force –AsPlainText
dir Cert:\CurrentUser\My | Where Subject -EQ 'CN=foo.azurewebsites.net' | Export-PfxCertificate -ChainOption BuildChain -Password $mypwd -FilePath E:\Scratch\fooCert.pfx
Function Test-DownloadUri {
<#
.SYNOPSIS
Tests that a url is valid
.DESCRIPTION
Returns a status code from an http request of a url. Used to verify that download links work.
.PARAMETER Uri
The url that we are checking is valid
.INPUTS
N/A