Skip to content

Instantly share code, notes, and snippets.

View ngrogg's full-sized avatar

Nicholas Grogg ngrogg

View GitHub Profile
@ngrogg
ngrogg / PowerShellCommands.md
Created May 26, 2024 01:31
Some useful PowerShell commands

Some useful PowerShell commands

Check disk use (Windows), run in PowerShell as admin:
Get-ChildItem c:\ -r -ErrorAction SilentlyContinue –Force |sort -descending -property length | select -first 10 name, DirectoryName, @{Name="MB";Expression={[Math]::round($_.length / 1MB, 2)}}
gci C:\inetpub -r| sort -descending -property length | select -first 10 name, @{Name="GB";Expression={[Math]::round($_.length / 1GB, 2)}}

Get subdirectory size in PowerShell:
$colItems = Get-ChildItem C:\ -ErrorAction SilentlyContinue -Force | Where-Object {$_.PSIsContainer -eq $true} | Sort-Object
foreach ($i in $colItems)
{

@ngrogg
ngrogg / LinuxDiskSpaceInode.md
Last active May 22, 2024 04:13
Some useful Linux disk space and inode commands

Some useful commands for Linux Disk and Inode space checking

Check disk space availability
df -h

Get size of folder
du -sh FOLDER

Get size of files in folder
ls -l --block-size=M

@ngrogg
ngrogg / GCloudCLICommands.md
Created March 27, 2024 12:51
Some Useful Google Cloud CLI Commands

Some Useful Google Cloud CLI Commands

If not done already, configure Google Cloud CLI.
Instructions below assume DEB based distro like Debian or Ubuntu.
Instructions from Google Cloud SDK Docs

Pre-requisities to install Google CLI (skip if already done)
Add GPG key,
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg

@ngrogg
ngrogg / someUsefulKubectlCommands.md
Last active March 27, 2024 09:58
Some useful kubectl commands

Some useful kubectl commands

Authenticate with cluster if using gcloud CLI,
gcloud container clusters get-credentials CLUSTER_NAME --region=COMPUTE_REGION

Run again with different value to set a new default cluster

List pods in cluster,
kubectl get pods