This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find $HOME/.ssh/ -type f -exec chmod 600 {} \;; find .ssh/ -type d -exec chmod 700 {} \;; find .ssh/ -type f -name "*.pub" -exec chmod 644 {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To login to alpine Linux LXD vm from host use the lxc command: | |
lxc exec alpine-lxd-vm-name-here bash | |
Assumes you have bash installed on the VM - see install-bash.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Things to note | |
# Single script, will survive reboot | |
# Script needs to be run under admin (will auto correct if not) | |
# Script needs internet access to download files | |
# Script assumes WinGet is installed | |
# | |
# Why aren't we using wsl --install -d Ubuntu | |
# Well, we want to WSL.exe install a bunch of stuff | |
# Ubuntu2004 install --root can't be done above so it requires user interaction | |
# if you don't need to install items on linux without setting root, this script becomes much simplier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
2010 Scripting Games PowerShell: Advanced Event 1 | |
Author: Cameron Ove | |
Date: 4/30/2010 | |
Copyright: NONE :-D | |
Synopsis of functions: | |
I really wanted to the ability to provide credentials when contacting remote workstations. | |
.Net seems limited in that regard. So I used WMI. | |
In paticular I used the root\default namespace and StdRegProv thus enabing the ability for credentials across the network. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Requires powershell 5 or later | |
Provides Get and Set functions for KnownFolders | |
.EXAMPLE | |
PS> Set-KnownFolderPath Desktop $ENV:USERPROFILE/Desktop | |
.EXAMPLE | |
PS> $Path="" | |
PS> Get-KnownFolderPath Desktop ([ref]$Path) | |
.LINK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -print0 | xargs -0 ls -l | awk '{ n=int(log($5)/log(2)); if (n<10) { n=10; } size[n]++ } END { for (i in size) printf("%d %d\n", 2^i, size[i]) }' | sort -n | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) } } { a[1]=$1; a[2]=0; human(a); printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) }' | |
--e.g. | |
-- 1k: 270448 | |
-- 2k: 72548 | |
-- 4k: 74510 | |
-- 8k: 62799 | |
-- 16k: 36386 | |
-- 32k: 74070 | |
-- 64k: 21528 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -xdev ! -type d -links +1 -printf '%20i %20D %p\n' | sort -n | uniq -w 42 --all-repeated=separate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -links 1 -print |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for directories: rwxr_xr_x | |
find . -type d -exec chmod 755 {} \; | |
# for files : rw_r__r__ | |
find . -type f -exec chmod 644 {} \; | |
# or wrap it in one command | |
find YOUR_CATALOG -type f -exec chmod 644 {} + -o -type d -exec chmod 775 {} + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt list --installed | |
# or | |
dpkg -l |
NewerOlder