Skip to content

Instantly share code, notes, and snippets.

View ajtrichards's full-sized avatar
🏠
Working from home

Alex Richards ajtrichards

🏠
Working from home
  • South Wales
View GitHub Profile
@ajtrichards
ajtrichards / scan-list-of-aws-ips.sh
Created February 15, 2022 19:40
Get a list of the public facing IP's from an AWS region and then, using NMAP, run a port scan.
aws ec2 describe-network-interfaces --query NetworkInterfaces\[\].Association.PublicIp | jq -r '.[]' | xargs -I{} nmap -v -A -sV {}
@ajtrichards
ajtrichards / lumen-query-log.php
Last active July 7, 2022 23:50
Laravel Lumen - Display Query Log
/**
* You must enable to Query Log when using Lumen.
*/
DB::connection()->enableQueryLog();
$queries = DB::getQueryLog();
$last_query = end($queries);
<?php
$builder = MyModel::where('active', 1);
$query = str_replace(array('?'), array('\'%s\''), $builder->toSql());
$query = vsprintf($query, $query->getBindings());
dd($query);
@ajtrichards
ajtrichards / exchange-o365-set-calendar-permissions.ps1
Created August 16, 2022 11:16
Powershell command to find all users in the Office365 installation and update the calendar permission to show Limited Details.
pwsh -Command 'Install-Module -Name PSWSMan'
pwsh -Command 'Install-Module -Name ExchangeOnlineManagement'
sudo pwsh -Command 'Install-WSMan'
Connect-ExchangeOnline -UserPrincipalName YOUR_EMAIL_ADDRESS
foreach($user in Get-Mailbox -RecipientTypeDetails UserMailbox) {
$cal = $user.alias+":\calendar"
write-host $cal