Skip to content

Instantly share code, notes, and snippets.

@cert01
cert01 / excel-australia-phone-numbers.md
Created December 1, 2021 21:38
Excel Phone Number Formatting - Australia

Excel Phone Number Formatting

Excel will by default strip the leading zero from a phone number cell, and accept any content as valid. The below number formats will modify phone number inputs as specified.

Input Human Readable International Human Readable International Azure Active Directory Azure AD Azure AD Graph Active Directory
0411223344 0411 223 344 (+61) 411 223 344 +614 1122 3344 +61 411223344 Mobile Phone mobilePhone telephoneNumber
0291223344 02 9122 3344 (+61) 2 9122 3344 +612 9122 3344 +61 291223344 Office Phone businessPhones mobile
@cert01
cert01 / check_trim.sh
Created December 15, 2021 23:58
Check and enable trim on Rasbian Buster
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
fstrim -v /
lsblk -D
# looking for Disk-Max 0B, which is not enabled
@cert01
cert01 / Find-GitRepository.ps1
Last active January 5, 2022 06:53 — forked from jdhitsolutions/Find-GitRepository.ps1
Use this PowerShell function to find Git repositories in the specified folder. It is assumed that you have the Git command line tools already installed.
Function Find-GitRepository {
<#
.SYNOPSIS
Find Git repositories
.DESCRIPTION
Use this command to find Git repositories in the specified folder. It is assumed that you have the Git command line tools already installed.
.PARAMETER Path
The top level path to search.
@cert01
cert01 / Repair_CloudKey.sh
Created January 27, 2022 23:41
Commands to repair Ubiquiti Cloudkey journal when it exceeds 32 bit memory space
# https://help.ui.com/hc/en-us/articles/360006634094-UniFi-SDN-Repairing-Database-Issues-on-the-UniFi-Controller#2
# https://help.ui.com/hc/en-us/articles/204911424-UniFi-How-to-Remove-Prune-Older-Data-and-Adjust-Mongo-Database-Size#4
cd ~
curl -kO https://help.ui.com/hc/article_attachments/115024095828/mongo_prune_js.js
curl -kO https://help.ui.com/hc/en-us/article_attachments/360008640574/CK_repair.js
service unifi stop
mongod --dbpath /usr/lib/unifi/data/db --smallfiles --logpath /usr/lib/unifi/logs/server.log --repair
@cert01
cert01 / macosExchangePowerShell.zsh
Last active April 12, 2022 07:21
How to get MACOS Monterey PowerShell Exchange Online Connection
brew install powershell
brew install openssl
newpath='export PATH=/opt/homebrew/opt/openssl@3/bin:$PATH'
if grep -q $newpath ~/.zshrc; then printf '%s\n' "$newpath" | tee -a ~/.zshrc; fi
source ~/.zshrc
pwsh -Command 'Install-Module -Name PowerShellGet'
pwsh -Command 'Install-Module -Name ExchangeOnlineManagement'
pwsh -Command 'Install-Module -Name PSWSMAN'
sudo pwsh -Command 'Install-WSMan'
# RunPowerShell
@cert01
cert01 / downloader
Last active April 20, 2022 03:01
Webcomix Download RealLifeComics
sw_vers
# ProductName: macOS
# ProductVersion: 12.3.1
# BuildVersion: 21E258
brew info python
# python@3.9: stable 3.9.12 (bottled)
# /opt/homebrew/opt/python@3.9/libexec/bin
export PATH=/opt/homebrew/opt/python/libexec/bin:$PATH
@cert01
cert01 / gist:d6ae429905a3172464adfdefa32184ac
Created April 29, 2022 01:27
Decode AndroidManifest.xml from APK AXML Format
# MAC OS
brew tap ytsutano/toolbox
brew install axmldec
axmldec -o AndroidManifest_Decoded.xml -i AndroidManifest.xml
brew uninstall axmldec
brew untap ytsutano/toolbox
@cert01
cert01 / Get-osx-arm64Teams.ps1
Last active June 20, 2022 02:20
Download latest Teams Client for MACOS M1 - Shell Script
$DateTimeNow = [datetime]::now
$DateTimeYesterday = $DateTimeNow.AddDays(-1)
$TeamsCreationTime = $(Get-ChildItem '/Applications/Microsoft Teams.app/').CreationTime
$TeamsDownloadLink = "https://raw.githubusercontent.com/ItzLevvie/MicrosoftTeams-msinternal/master/defconfig"
$TeamsAlreadyDownloaded = Test-Path ./Teams_osx.pkg
if ($TeamsCreationTime -lt $DateTimeYesterday) {
@cert01
cert01 / Get-PingSweep.ps1
Created August 19, 2022 06:40 — forked from joegasper/Get-PingSweep.ps1
Get-PingSweep - super fast (~500ms) subnet ping sweep with option to resolve IP address
# Inspiration from https://twitter.com/mrhvid/status/929717169130176512 @mrhvid @Lee_Holmes
function ResolveIp($IpAddress) {
try {
(Resolve-DnsName $IpAddress -QuickTimeout -ErrorAction SilentlyContinue).NameHost
} catch {
$null
}
}
@cert01
cert01 / get-australianpublicholidays.ps1
Created November 15, 2022 01:27
Powershell - Grab Australian Public Holidays
# 2021-2023
#$uri = 'https://data.gov.au/data/dataset/b1bc6077-dadd-4f61-9f8c-002ab2cdff10/resource/33673aca-0857-42e5-b8f0-9981b4755686/download/australian-public-holidays-combined-2021-2023_33673aca-0857-42e5-b8f0-9981b4755686-updated.csv'
# 2023
$uri = 'https://data.gov.au/data/dataset/b1bc6077-dadd-4f61-9f8c-002ab2cdff10/resource/d256f989-8f49-46eb-9770-1c6ee9bd2661/download/australian_public_holidays_2023.csv'
$webrequest = Invoke-WebRequest -Uri $uri
$resultobject = $webrequest.Content | ConvertFrom-Csv
$outputObject = $resultobject | Select-Object @{Name="Date";Expression={'{0:dd/MM/yyyy}' -f $([DateTime]::ParseExact($_.Date, 'yyyyMMdd', $null))}},'Holiday Name', Information
$outputObject | Format-Table -AutoSize