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
@nordineb
nordineb / keybase.md
Created March 26, 2018 14:36
GitHub identity

Keybase proof

I hereby claim:

  • I am nordineb on github.
  • I am nordineb (https://keybase.io/nordineb) on keybase.
  • I have a public key whose fingerprint is D8A3 E77F 6D7C 29F9 C577 07BC 0045 F242 17B5 7521

To claim this, I am signing this object:

@nordineb
nordineb / FindSPN.ps1
Created March 27, 2018 06:23
List all SPNs used in your Active Directory
cls
$search = New-Object DirectoryServices.DirectorySearcher([ADSI]"")
$search.filter = "(servicePrincipalName=*)"
## You can use this to filter for OU's:
## $results = $search.Findall() | ?{ $_.path -like '*OU=whatever,DC=whatever,DC=whatever*' }
$results = $search.Findall()
foreach( $result in $results ) {
$userEntry = $result.GetDirectoryEntry()
@nordineb
nordineb / README.md
Last active March 24, 2023 22:21
Removing HTTP headers

Checking HTTP headers with CURL

curl -I -L https://test-etf.udir.tech
Restart-Computer

Remove ASP.Net MVC Default HTTP Headers

Global.asax.cs

@nordineb
nordineb / README.md
Last active December 14, 2023 00:05
Windows Server Core Survival Guide

Set the keyboard layout

CHCP 65001
Import-Module International
powercfg -h off
powershell Set-WinUserLanguageList -LanguageList Nb-no -Force
Set-Culture nb-NO
&tzutil.exe /s "Romance Standard Time"
<key name="Colors" modified="2015-12-10 22:46:43" build="151210">
<value name="Count" type="dword" data="00000001"/>
<key name="Palette1" modified="2015-12-10 22:46:43" build="151210">
<value name="Name" type="string" data="Material Theme"/>
<value name="ColorTable00" type="dword" data="004d4335"/>
<value name="ColorTable01" type="dword" data="006b60eb"/>
<value name="ColorTable02" type="dword" data="008de8c3"/>
<value name="ColorTable03" type="dword" data="0095ebf7"/>
<value name="ColorTable04" type="dword" data="00c4cb80"/>
<value name="ColorTable05" type="dword" data="009024ff"/>
@nordineb
nordineb / Show-Azurehealth.ps1
Created April 13, 2018 07:58
Show-Azurehealth.ps1
function IsLoggedIn
{
$content = Get-AzureRmContext -ErrorAction SilentlyContinue
if ($content)
{
return !([string]::IsNullOrEmpty($content.Account))
}
return $false
}
@nordineb
nordineb / README.md
Last active April 24, 2018 10:51
Enable HTTP/2 and TLS 1.2 in Azure App Service
Login-AzureRmAccount

$resourceGroupName = "MYRESOURCEGROUP"  
$resourceName = "MYAPPSERVICE"

$webapp = Get-AzureRmResource `
    -ResourceGroupName $resourceGroupName `
    -ResourceType Microsoft.Web/sites/config `
 -ResourceName "$resourceName/web" `
@nordineb
nordineb / README.md
Last active July 9, 2018 13:08
docker seq

Use powershell og bash

#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)

diginc/pi-hole                               latest                    bb640716ae33        2 months ago        363MB
azuresdk/azure-cli-python                    latest                    7424f32d32f1        3 months ago        368MB
@nordineb
nordineb / README.md
Last active June 15, 2018 06:36
Psake notes

install the module (Elevated powershell prompt)

Install-Module -Name psake

import the module

Import-Module psake

import teamcity helpers we use

Import-Module .\teamcity.psm1

list all tasks

@nordineb
nordineb / README.md
Created June 15, 2018 06:27
Disable Weak Ciphers
#Requires -Version 4
#Requires -RunAsAdministrator

$Protocols = @('PCT 1.0','SSL 2.0','SSL 3.0','TLS 1.0') # Leaving 'TLS 1.1' and 'TLS 1.2'
$Hashes    = @('MD5','SHA') # SHA1 that is, leaving 'SHA 256', 'SHA 384', and 'SHA 512' 
$Ciphers   = @(
    'DES 56/56'