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
# This scripts goes over *.txt files within specified dir | |
# It stops and returns exit code 1 as soon as it finds empty line within a file | |
# In no empty lines found exit code 0 is returned | |
# You can use "echo $?" command to view exit code post sh script execution | |
cd $dir | |
for f in *.txt; do | |
perl -lne 'exit 1 if(/^$/)' $f | |
if [[ $? == 1 ]]; then | |
echo "Inside of the loop" |
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
# This script will scale down all deployments except for specified in grep condition | |
kubectl get deploy -n NAMESPACE-NAME | grep -v 'deploymentA\|deploymentB\|deploymentC' | awk '{print $1}' | while read line; do | |
#echo $line | |
kubectl scale deploy $line --replicas=0 | |
done |
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
# In elevated CMD switch WSL distro default user to root (adjust distro name as necessary) | |
ubuntu2204 config --default-user root | |
# Open WSL session - it will be opened with root user, set password for your user | |
passwd username | |
# Switch your default distro user back to your user from elevated cmd window | |
ubuntu2204 config --default-user username |
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
NS=<NAMESPACE_NAME> | |
POD_NAME=<POD_NAME> | |
kubectl exec -n $NS --stdin --tty $POD_NAME -- /bin/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
# Update DNS - set/add | |
az vmss update -n vmss-name --set virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].dnsSettings='{"dnsServers":["10.10.10.1", "10.10.10.2"]}' --resource-group rg-name | |
# Verify | |
az vmss show --resource-group rg-name --name vmss-name | grep 10.10.10. |
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
# Check WT version | |
wt --version |
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
# https://docs.microsoft.com/en-us/azure/virtual-machines/linux/resize-os-disk-gpt-partition | |
# LVM Linux (RHEL/CentOS) | |
# Confirm partition type (MBR/GPT) | |
parted | |
# Check available space | |
sudo pvs | |
# Identify LV for / - e.g. sda2 rootvg-rootlv | |
lsblk -f | |
# Check available space within VG | |
vgdisplay rootvg |
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
cat <<EOF > ~/.bash_aliases | |
# To set permanent bash aliases create/change ~/.bash_aliases | |
# And refer to .bash_aliases in .bashrc | |
alias k='kubectl' | |
alias kc='k config view --minify | grep name' | |
alias kdp='k describe pod' | |
alias kd='k describe pod' | |
alias ke='k explain' | |
alias kf='k create -f' | |
alias kg='k get pods --show-labels' |
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
# Make sure to run Connect-AzAccount first | |
$Subscription = "SUBSCRIPTION_NAME" | |
$Location = "REGION_NAME" | |
$ResourceGroup = "RESOURCE_GROUP_NAME" | |
Set-AzContext -SubscriptionName $Subscription | Out-Null | |
$TotalCores = $null | |
$TotalWorkers = (Get-AzVM -ResourceGroupName $ResourceGroup -Status | Where-Object { ( | |
$_.ProvisioningState -eq "Succeeded" ) }) | |
foreach ($Worker in $TotalWorkers) { |
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
# https://www.linuxtechi.com/extend-lvm-partitions/ | |
df -h /home/ | |
sudo lvextend -L +31.50G /dev/mapper/rootvg-homelv | |
sudo resize2fs /dev/mapper/rootvg-homelv |
NewerOlder