Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
ciphertxt / Getting Your SharePoint Farm Information
Created October 26, 2015 13:56 — forked from PCfromDC/Getting Your SharePoint Farm Information.ps1
This PowerShell script gets all of your SharePoint Farm's information
#Get Backup Path
$bkdir = read-host("Enter Folder Location eg: (C:\temp)") # Get Backup Path!
if ($bkdir.EndsWith("\")){$bkdir = $bkdir.TrimEnd("\")}
# Set Backup Path if you want to hard code your path
#$bkdir = "\\serverName\Shared\Temp" (optional "C:\Temp")
# Verify folder exists
if ((test-path $bkdir) -eq $false ) # Verify folder else create it...
{
@ciphertxt
ciphertxt / openmsedgeprofilemacos.sh
Created July 13, 2022 18:42
Opens a specific Microsoft Edge profile by name on macOS
# Navigate to the profiles directory
cd ~/Library/Application\ Support/Microsoft\ Edge
# List out the profile directories. Note that the directory name is what is used in the launch command, *not* necessarily the friendly name of the profile you see in Microsoft Edge.app
find ./ -type f -name Preferences
# Let's say "Profile 1" is one of our directories
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" --profile-directory="Profile 1"
@ciphertxt
ciphertxt / Get-MsolRolesAndMembers.ps1
Created May 10, 2016 12:43
Retrieves a list of current roles and the associated role members in an Office 365 tenant.
Import-Module MSOline -EA 0
Connect-MsolService -Credential (Get-Credential)
$admins=@()
$roles = Get-MsolRole
foreach ($role in $roles) {
$roleUsers = Get-MsolRoleMember -RoleObjectId $role.ObjectId
1. NEVER mention that you’re an AI.
2. Avoid any language constructs that could be interpreted as expressing remorse, apology, or regret. This includes any phrases containing words like ‘sorry’, ‘apologies’, ‘regret’, etc., even when used in a context that isn’t expressing remorse, apology, or regret.
3. If events or information are beyond your scope or knowledge cutoff date, provide a response stating ‘I don’t know’ without elaborating on why the information is unavailable.
Refrain from disclaimers about you not being a professional or expert.
4. Keep responses unique and free of repetition.
5. Never suggest seeking information from elsewhere.
@ciphertxt
ciphertxt / SampleFunctionTemplate.ps1
Created March 26, 2013 11:42
PowerShell Advanced function template
function Function-Name {
<#
.Synopsis
The short function description.
.Description
The long function description
.Example
C:\PS>Function-Name -param "Param Value"
This example does something
## Monitor Azure Storage
### https://aka.ms/azuremonitor/storage-metrics
## Azure Monitor Metrics Overview
### https://docs.microsoft.com/en-us/azure/azure-monitor/platform/data-platform-metrics
## Azure Storage monitoring data reference
### https://docs.microsoft.com/en-us/azure/storage/common/monitor-storage-reference
## Azure Monitoring REST API walkthrough
@ciphertxt
ciphertxt / GetBitsTransferProgress.ps1
Created March 18, 2014 01:57
Progress bar for current "Transferring" BITS Transfers with a time remain calculation.
while ((Get-BitsTransfer | ? { $_.JobState -eq "Transferring" }).Count -gt 0) {
$totalbytes=0;
$bytestransferred=0;
$timeTaken = 0;
foreach ($job in (Get-BitsTransfer | ? { $_.JobState -eq "Transferring" } | Sort-Object CreationTime)) {
$totalbytes += $job.BytesTotal;
$bytestransferred += $job.bytestransferred
if ($timeTaken -eq 0) {
#Get the time of the oldest transfer aka the one that started first
$timeTaken = ((Get-Date) - $job.CreationTime).TotalMinutes
@ciphertxt
ciphertxt / exiftool_examples.sh
Last active October 29, 2022 22:01
exiftool shortcuts
# Read time metadata
exiftool -a -G1 -s -time:all *.JPG
# Update time metadata
# ModifyDate
exiftool -overwrite_original -d "%Y:%m:%d %H:%M:%S" -v "-AllDates<ModifyDate" "-FileModifyDate<ModifyDate" *.JPG
# DateTimeOriginal
exiftool -overwrite_original -d "%Y:%m:%d %H:%M:%S" -v "-AllDates<DateTimeOriginal" "-FileModifyDate<DateTimeOriginal" *.JPG
# Sync parent folder and subfolders recursively
rsync -avP Takeout/Google\ Photos/ /Volumes/Multimedia/Pictures/Google\ Photos
# Exclude json files and consolidate into a flat folder
rsync -avP --exclude='*.json' Takeout/Google\ Photos/*/ organize/datefix
#!/bin/bash
i=1;
for youtube_uri in "$@"
do
echo "Downloading video $i: $youtube_uri";
i=$((i + 1));
yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio/best[ext=mp4]/best' --merge-output-format mp4 "$youtube_uri" --add-metadata --embed-thumbnail
done