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 / windows_hardening.cmd
Created May 13, 2020 20:56 — forked from mackwage/windows_hardening.cmd
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Obligatory 'views are my own'. :)
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Thank you @jessicaknotts for the help on testing Exploit Guard configs and checking privacy settings!
:: Best script I've found for Debloating Windows 10:
nordineb /
Created October 11, 2017 14:42
userPrincipalName(UPN) Vs samAccountName

userPrincipalName(UPN) Vs samAccountName

The samAccountName is the User Logon Name in Pre-Windows 2000 (this does not mean samAccountName is not being used as Logon Name in modern windows systems). The userPrincipalName is a new way of User Logon Name from Windows 2000 and later versions. user Name part can be different for the same user like DomainName\testUser and userTest@DomainName.Com.


  • The samAccountName attribute is the user logon name used to support clients and servers from a previous version of Windows ( Pre-Windows 2000).
  • The user logon name format is : DomainName\testUser.
  • The samAccountName must be unique among all security principal objects within the domain.
  • The samAccountName should be less than 20 characters.
  • Query for the new name against the domain to verify that the samAccountName is unique in the domain.
nordineb /
Created July 11, 2018 08:15
Clear Temporary Internet Files
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess <number>

The parameter is required and is derived from some combination of the following values, represented as a decimal number.

1    = Browsing History
2    = Cookies
4 = Temporary Internet Files
nordineb /
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"
nordineb / Get-AzureRmCachedAccessToken.ps1
Created October 26, 2017 10:50
AccessToken (Bearer) from an existing Azure PowerShell session
function Get-AzureRmCachedAccessToken()
$ErrorActionPreference = 'Stop'
if(-not (Get-Module AzureRm.Profile)) {
Import-Module AzureRm.Profile
$azureRmProfileModuleVersion = (Get-Module AzureRm.Profile).Version
# refactoring performed in AzureRm.Profile v3.0 or later
if($azureRmProfileModuleVersion.Major -ge 3) {
nordineb /
Created October 30, 2023 19:46
Insert billions of records

Insert billions of records

CREATE TABLE bigtable (
    column1 varchar(MAX),
    column2 varchar(MAX),
    column3 varchar(MAX),
 	column4 varchar(MAX),
 	column5 varchar(MAX),
 	column6 varchar(MAX),
nordineb /
Created October 30, 2023 19:41
ubuntu setup



sudo dpkg-reconfigure locales


nordineb /
Last active October 30, 2023 19:35
SHA512 digest

sha512 digest


echo -n 12345678900 | openssl dgst -binary -sha512 | base64


package main
nordineb /
Created September 21, 2023 14:16 — forked from gboudreau/
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators

There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

nordineb / readme.MD
Last active August 11, 2023 13:31
Gnome Boxes, an alternative to Virtual box and VMware

Gnome Boxes, a front-end tool for Kernel-based Virtual Machine (KVM), is created within the framework of the Gnome Desktop Environment, it does not require the installation of any additional software. With KVM directly integrated into the Linux kernel, Boxes does not have to worry about virtualization. The software simply provides the VM with the environment, using existing libraries and applications such as libvirt and Qemu.

Alternatively, use