1) Find duplicate files. This one time, I needed to find all the duplicate files in two directories. find 1/* 2/* -type f -exec md5sum {} \; | sed -e s,1/,,g -e s,2/,,g | sort | uniq -c | egrep "^[[:space:]]+2" The output looks like this: 2 d308c1674d2c49d53872fe522d9943bf README The "2" indicates that there were two files with this hash and name. 2) Grab DNS requests from a PCAP using tshark. tshark -r [filename.pcapng] -T fields -e ip.src -e dns.qry.name -Y "dns.flags.response eq 0 and ip.src ne 10.0.20.12 and not (dns.qry.name contains google) and not (dns.qry.name contains facebook) and not (dns.qry.name contains youtube) and not (dns.qry.name contains akamai) and not (dns.qry.name contains fbcdn.net)" 3) Sign a JAR using .keystore file. jarsigner -keystore [my.keystore] -storepass 'password' -tsa http://timestamp.digicert.com [file.jar] [alias] 4) "grep" in PowerShell. sls [string] [file] -ca | select -exp line 5) Change IPv6 address on Failover Cluster node. Get-ClusterResource "DHCP IPv6 Addr" | Set-ClusterParameter @{"Address"="2001:db8::"} 6) Strip the filename extensions from a collection of items. foreach ($file in Get-ChildItem) { Rename-Item $file $file.fullname.replace(".txt","") } Alternately, here is a technique to append a filename extension in bulk: foreach ($file in Get-ChildItem) { Rename-Item $file "$file.txt" } 7) Change the PowerShell prompt. Function prompt {"# "} 8) Extract the Google searches with the word "define:" in them from https://myactivity.google.com/myactivity JSON output. (Get-Content *.json | ConvertFrom-Json).event.query | where-object { $_.query_text -like "define:*" } | select-object query_text | % { $_.query_text.replace("define:","") } | sort-object -Unique 9) Get currently logged-on user for a specific $hostname. Get-WinEvent -Computer $hostname -FilterHashtable @{Logname='Security';ID=4803} -MaxEvents 30 | select @{N='User';E={$_.Properties[1].Value}} 10) Build an alphabet. $alphabet = [char[]]([char]'a'..[char]'z') 11) Get the serial number from a list of $hostnames. Get-wmiobject Win32_Bios -ComputerName $hostnames | Select-Object __SERVER, SerialNumber 12) Stream a video over IP multicast using VLC. vlc.exe --sout udp:239.5.5.5:1234 D:\file.mpeg --ttl 16 13) Is my terminal 80 characters wide? perl -e 'print "*" x 80; print "\n";' 14) Who is logged in to a remote Windows computer? (https://stackoverflow.com/a/30917569/5459668) query user /server:$SERVER 15) Insert an ephemeral static route: New-NetRoute -AddressFamily ipv4 -DestinationPrefix "192.0.2.0/24" -NextHop "198.51.100.2" -ifAlias "Loopback" -PolicyStore ActiveStore New-NetRoute -AddressFamily ipv4 -DestinationPrefix "203.0.113.0/24" -NextHop "198.51.100.2" -ifAlias "Loopback" -PolicyStore ActiveStore 16) Iterate over PuTTY saved sessions and do something useful, such as pscp or plink: Get-ItemProperty -Path "HKCU:\Software\SimonTatham\PuTTY\Sessions\*" -Name HostName,UserName | ForEach-Object { plink -l $_.UserName $_.HostName } Get-ItemProperty -Path "HKCU:\Software\SimonTatham\PuTTY\Sessions\*" -Name HostName,UserName | ForEach-Object { pscp -scp -l $_.UserName "$($_.HostName):nvram:startup-config" "$($_.PSChildName) backup $(Get-Date -Format FileDate).txt" } 17) Test the SHA-512 hash of a file named 'foo' against the contents of 'foo.sha512'. function Check-File ($f) { return (Get-FileHash -Algorithm SHA512 $f).Hash.toString().toLower() -eq (Get-Content -Path "$($f).sha512"); } 18) Convert a Julia vector into an R column. v2c(v) = chop(reduce((a, x) -> a * string(x) * ",", v, init="c(")) * ")" 19) Create normally distributed random numbers in Excel (runif -> rnorm). =NORM.INV(RAND(),0,1) 20) Compute the line of best fit for matrix X (size m*n) and vector Y (size m*1). xa = hcat(ones(size(x, 1)), x); beta = inv(transpose(xa) * xa) * transpose(xa) * y 21) Sum of the squares of errors sse(prediction, actual) = sum((prediction - actual).^2) 22) Create zero-padded directories 01 through 15 in Julia. mkdir.(lpad.(1:15, 2, "0")) 23) Run the latest php:apache container with Docker from the current working directory. docker run -dit --name my-php-test-site -p 8080:80 -v "$PWD":/var/www/html/ php:apache docker ps docker stop my-php-test-site docker rm my-php-test-site 24) Generate a random MAC address with the U/L bit clear (unicast) and locally administered bit set. (Using Julia). random_mac() = reverse(string.(digits(rand(UInt64) & 0xfeffffffffff | 0x020000000000, base = 16, pad = 12), base = 16)) |> a -> [a[2i-1] * a[2i] for i in 1:div(length(a), 2)] |> b -> join(b, "-") 25) Estimate the jitter (variable latency) to a networked host using the standard deviation of ping round-trip times (in PowerShell). (Test-Connection wjholden.com -Count 10).Latency | Measure-Object -Average -Minimum -Maximum -StandardDeviation 26) Multiply two polynomials quickly. Coefficients are interpretted with the least-significiant term first. You may need to pad enough zeros to fit the result. ifft(fft(x) .* fft(y)) 27) Filter Facebook posts for IOS tips. @pipe JSON3.read(read("your_posts_1.json")) |> filter(x -> hasproperty(x, :data) && length(x.data) > 0 && hasproperty(x.data[1], :post), _) |> map(x -> x.data[1].post, _) |> filter(x -> occursin(r"Cisco IOS tip"i, x), _) 28) Hideous JShell create directories 01-25. IntStream.range(1, 26).mapToObj(i -> i < 10 ? "0" + Integer.toString(i) : Integer.toString(i)).forEach(s -> new File(s).mkdir()) 29) Iterate over directories and do something in Bash. for dir in ./*/; do cd "${dir}"; go run main.go; cd -; done 30) Set the MAC address in PowerShell. Set-NetAdapterAdvancedProperty -Name Ethernet -DisplayName "Network Address" -DisplayValue "020000000000"