Skip to content

Instantly share code, notes, and snippets.

@datavudeja
datavudeja / export.ps1
Created June 5, 2026 15:45 — forked from DineshSolanki/export.ps1
Save Windows environment variables to restore to another PC
# Export current environment variables
$currentDate = Get-Date -Format "yyyyMMdd_HHmmss"
$exportPath = ".\env_backup_$currentDate"
# Create export directory if it doesn't exist
New-Item -ItemType Directory -Force -Path $exportPath
# Get all environment variables from different scopes
$machineEnv = [System.Environment]::GetEnvironmentVariables('Machine')
$userEnv = [System.Environment]::GetEnvironmentVariables('User')
@datavudeja
datavudeja / GetFolderSizes.ps1
Created June 1, 2026 19:42 — forked from ziyan0302/GetFolderSizes.ps1
show the size of the folders in current location
# Get all directories in the current location
$folders = Get-ChildItem -Directory
# Iterate over each directory and calculate its size
foreach ($folder in $folders) {
$folderPath = $folder.FullName
$size = (Get-ChildItem -Recurse -Force $folderPath | Measure-Object -Property Length -Sum).Sum
$sizeMB = [math]::round($size / 1MB, 2)
Write-Output "Folder: $folderPath, Size: $sizeMB MB"
}
#Function to Get Permissions Applied on a particular Object, such as: Web, List or Folder
Function Get-PnPPermissions([Microsoft.SharePoint.Client.SecurableObject]$Object)
{
#Determine the type of the object
Switch($Object.TypedObject.ToString())
{
"Microsoft.SharePoint.Client.Web" { $ObjectType = "Site" ; $ObjectURL = $Object.URL; $ObjectTitle = $Object.Title }
"Microsoft.SharePoint.Client.ListItem"
{
$ObjectType = "Folder"
@datavudeja
datavudeja / till_brooklyn.ps1
Created June 1, 2026 04:58 — forked from windoze95/till_brooklyn.ps1
A no sleep script for Windows that moves the cursor in the shape of a heart every two minutes.
<# --------------------------------------------------------------------
No Sleep v2.2 - 2025
- Moves the cursor in the shape of a heart every 120s.
- Pauses after a set time of true user absence to allow the computer to sleep.
- Default pause time is 2 hours, but can be overridden with an argument (e.g., .\script.ps1 1.5).
- Designed to work in locked-down corporate environments, avoids the use of external DLLs or WMI.
-------------------------------------------------------------------- #>
#region -- WIN32 API HELPERS (Idle Time & Mouse Nudge) --
@datavudeja
datavudeja / Readme.md
Created May 31, 2026 22:14 — forked from jvarelaaloisio/Readme.md
Remove directories based on name. Really useful for temporary folders, like "Library" in the unity engine.

Summary of the arguments for the script:

Script Arguments Summary

  • -f, --foldername: Specifies the name of the folder to search and remove (FolderName).

  • -d or --directory: Specifies a custom directory path from the command line.

  • -p, --permanent: Optional flag that indicates whether to permanently remove the folders (Permanent).

@datavudeja
datavudeja / Get-Hashes.ps1
Created May 30, 2026 11:44 — forked from t94j0/Get-Hashes.ps1
You need it every once in a while
Get-ChildItem -Recurse -File | Select-Object @{Name="FileName";Expression={$_.Name}}, @{Name="MD5";Expression={(Get-FileHash $_.FullName -Algorithm MD5).Hash}}, @{Name="SHA256";Expression={(Get-FileHash $_.FullName -Algorithm SHA256).Hash}} | Export-Csv -Path "FileHashes.csv" -NoTypeInformation; Import-Csv "FileHashes.csv" | Format-Table -AutoSize
@datavudeja
datavudeja / commands.md
Created May 29, 2026 10:09 — forked from johananj/commands.md
[Rclone Quick Reference] Cheatsheet for rclone commands.
  • To show existing configurations: rclone config show
  • To mount a drive: rclone mount --daemon remote_name: /home/user/mount_folder/
  • To unmount: umount /home/user/mount_folder
  • To copy a folder to drive: rclone copy ~/folder_name remote_name:folder_name
  • To copy a folder if it's a day old, without traversing through all the existing files in the remote: rclone copy --max-age 24h --no-traverse ~/folder_name remote_name:folder_name
  • To sync two folders, one in local and another in remote: rclone sync ~/folder_name remote_name:folder_name
  • In copy or sync
    • To see a dry run use: --dry-run
    • To see progress use: --progress
@datavudeja
datavudeja / Get-FolderSize.ps1
Created May 21, 2026 14:29 — forked from AshFlaw/Get-FolderSize.ps1
Get size of folder
Function Get-FolderSize {
[cmdletbinding()]
param
(
[Parameter(Mandatory = $false)]
[Alias('Path')]
[String[]]
$BasePath = 'C:\',
[Parameter(Mandatory = $false)]
[Alias('User')]
@datavudeja
datavudeja / folders_usage.ps1
Created May 21, 2026 14:29 — forked from FredoVelcro/folders_usage.ps1
PowerShell list folders sizes
# usage: .\folders_usage.ps1 'C:\Program Files (x86)\' -Tree 2
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Folder,
[int]$Tree = 0
)
if (-not (Test-Path $Folder)) {
Write-Error "Folder '$Folder' does not exist."