Git to list changed files

Today I want to make a brief summary of git log possibilities. There’s a huge range of git log commands to choose from. I have chosen only a few. Let’s limit git response to the latest commit with HEAD^! target….

Disable FC adapter (qla2xxx) in SystemRescueCD

During the boot of SystemRescueCD hit TAB and append: noload=qla2xxx,scsi_transport_fc,scsi_tgt

PowerCLI to start and stop Remote Tech Support (SSH)

Another PowerCLI one-liner to start Remote Tech Support (SSH) on ESX/ESXi: Get-Cluster -Name "CIT2 CLuster" | Get-VMHost | Get-VMHostService | ? {$_.Key -eq "TSM-ssh"} | Start-VMHostServiceGet-Cluster -Name "CIT2 CLuster" | Get-VMHost | Get-VMHostService | ? {$_.Key -eq "TSM-ssh"} | Start-VMHostService…

Sed to extract email addresses from file

sed -e "s/^.*<\(.*\)>.*$/\1/" /file_with_emails | sort | \ uniq | tr "[:upper:]" "[:lower:]"sed -e "s/^.*<\(.*\)>.*$/\1/" /file_with_emails | sort | \ uniq | tr "[:upper:]" "[:lower:]" PS: Filip, he’s terribly smart, I guess the only one to read my blog, pointed…

Get VM ethernet info and state

PowerCLI > Get-VM -Name builder2 | Get-NetworkAdapter| Format-List -Property *     MacAddress : 00:50:56:90:34:9d WakeOnLanEnabled : True NetworkName : Network Type : e1000 ParentId : VirtualMachine-vm-4650 Parent : builder2 Uid : / alMachine-vm-4650/NetworkAdapter=4000/ ConnectionState : Connected, GuestControl, StartConnected…

Disconnect all mounted CD-ROMs in VMware cluster

PowerCLI > Get-VM | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$falsePowerCLI > Get-VM | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false

Get VMs with disconnected virtual ethernet

PowerCLI > Get-NetworkAdapter (get-vm | where {$_.powerstate -eq “poweredon”}) | Where { $_.connectionstate.connected -eq “$null” } | select parent, connectionstate   Parent ConnectionState —— ————— licenser NotConnected, GuestControl, NoStartC…PowerCLI > Get-NetworkAdapter (get-vm | where {$_.powerstate -eq “poweredon”}) | Where {…

Centos 6 public key authentication fix

Due to SELinux enabled we are not able to use public key authentication on Centos 6. Here is the quick fix: test -x /sbin/restorecon && /sbin/restorecon .ssh .ssh/authorized_keystest -x /sbin/restorecon && /sbin/restorecon .ssh .ssh/authorized_keys

Generating passwords with /dev/random

One-liner to generate passwords, lock files, etc. watch -n5 ‘cat /dev/urandom | tr -dc [:alnum:] | head -c12; echo’watch -n5 ‘cat /dev/urandom | tr -dc [:alnum:] | head -c12; echo’

PowerCLI to add vlan to vmware cluster

One-liner to add VLANs to the all hosts within vSphere cluster: Get-Cluster "CIT Cluster" | Get-VMHost | Get-VirtualSwitch -name vSwitch0 | New-VirtualPortGroup -name "Networking – Vlan80" -VLanId 80Get-Cluster "CIT Cluster" | Get-VMHost | Get-VirtualSwitch -name vSwitch0 | New-VirtualPortGroup -name "Networking…

Fork me on GitHub