Skip to content

Instantly share code, notes, and snippets.

@Azooz2014
Azooz2014 / Create-Administrator.ps1
Created January 10, 2024 11:33 — forked from ducas/Create-Administrator.ps1
Create a local administrator account using PowerShell
$Username = "su"
$Password = "password"
$group = "Administrators"
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
$existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $Username }
if ($existing -eq $null) {
@Azooz2014
Azooz2014 / windows-keys.md
Created December 24, 2023 10:53
Windows Product Keys

NOTE

These are NOT product / license keys that are valid for Windows activation.
These keys only select the edition of Windows to install during setup, but they do not activate or license the installation.

Index

@Azooz2014
Azooz2014 / email_warning_banner.html
Created October 12, 2023 06:48
Email Warning Banner
<!-- Yellow caution banner -->
<table border=0 cellspacing=0 cellpadding=0 align="left" width="100%">
<tr>
<!-- Remove the next line if you don't want the Yellow bar on the left side -->
<td style="background:#ffb900;padding:5pt 2pt 5pt 2pt"></td>
<td width="100%" cellpadding="7px 6px 7px 15px" style="background:#fff8e5;padding:5pt 4pt 5pt 12pt;word-wrap:break-word">
<div style="color:#222222;">
<span style="color:#222; font-weight:bold;">Caution:</span>
This email is originated from outside of Emaar.
@Azooz2014
Azooz2014 / Excel formula to sum only unique values
Created February 14, 2023 09:38
Excel formula to sum only unique values
=IF(1/COUNTIF(`$range$:$range`,`criteria`)=1,SUMIF(`range to sum`,`criteria`,`sum`),0)
@Azooz2014
Azooz2014 / Bypass password protection on VBA projects in excel
Created November 30, 2022 14:30
Bypass password protection on VBA projects in excel
// source: https://stackoverflow.com/questions/1026483/is-there-a-way-to-crack-the-password-on-an-excel-vba-project/31005696#31005696
//how it works
//Open the file(s) that contain your locked VBA Projects.
//Create a new file with the same type as the above and store this code in Module1
Option Explicit
Private Const PAGE_EXECUTE_READWRITE = &H40
@Azooz2014
Azooz2014 / Excel formula to remove trailing spaces
Last active November 13, 2022 06:36
Excel formula to remove trailing spaces
=TRIM(SUBSTITUTE(`cell to remove spaces from`, CHAR(160), " "))
@Azooz2014
Azooz2014 / get_dir_name_list_with_date_export_to_csv.ps1
Last active September 12, 2022 08:59
Get Directories names with last write formated date and save it to csv file.
$path = "" # Your Folder Path here.
Get-ChildItem -Directory -Depth 1 $path |
Select-Object @{
name='Fullname'; # Can be replaced with Name if you want just directory name.
expression={$_.FullName}
}, @{
name='LastWriteTime';
expression={($_.LastWriteTime).toShortDateString()}
} | Export-Csv -Path "Output path" -NoTypeInformation
## How to hide API keys from github ##
1. If you have already pushed commits with sensitive data, follow this guide to remove the sensitive info while
retaining your commits: https://help.github.com/articles/remove-sensitive-data/
2. In the terminal, create a config.js file and open it up:
touch config.js
atom config.js
@Azooz2014
Azooz2014 / get_dir_name_list_with_date.ps1
Last active September 12, 2022 08:59
Get Directories names with last write formated date.
$path = "" # Your Folder Path here.
Get-ChildItem -Directory -Depth 1 $path |
Select-Object @{
name='Fullname'; # Can be replaced with Name if you want just directory name.
expression={$_.FullName}
}, @{
name='LastWriteTime';
expression={($_.LastWriteTime).toShortDateString()}
}
@Azooz2014
Azooz2014 / Resource.kt
Created February 26, 2022 11:31
Generic wrapper class for handling states when retriving data from API or local databases.
sealed class Resource<T>(val data: T? = null, val message: String? = null){
class Success<T>(data: T) : Resource<T>(data)
class Loading<T>(data: T? = null) : Resource<T>(data)
class Error<T>(data: T? = null, message: String) : Resource<T> (data, message)
}