Author Archives: bolt

Perl one-liner to create random passwords

Just wrote this thing. Putting it here, in case anyone needs it. perl -e ‘my @c = ((‘a’..’z’), (‘A’..’Z’), (0..9)); for(1..128) {print $c[int(rand($#c+1))]}’ It creates random passwords, with the length specified by the number following “1..”, which is 128, in this example. Example outputs: lFcQYCtPl653r9D3cSfcFyeLJlbdDNPrxeIjkf6c77CjBRgtTRHKKL824La4giNLJkza66CzlecoOExPeuEJyQAnHFOQpcPsPbRiycSttCXwGhYK40BfQFlLWJapPltu HQVfvdUrkOOExPAiH5ry7u177TjgsDnfW4FlVuDeU3f833kPAe9z4XKZuKhqYaTZAd7wzuAgX8eTWM79TgDymNJWZ8RNRa30DuNSd5xCZ6rkMS00q35R4jWxR7Ztzbfn dCAlGY0KfNlPfp9D2DuhNHM8oqXFijXrjaRWxidzydzjUF61i0sAitCiZUiOrBsZwToqWXXMbxxjo6kKOIb5MxFQPkuIfsteavxd6gX2I7sQhJh4MmztondoikQ4Pb6i

How to use Invoke-WebRequest in PowerShell without having to first open Internet Explorer

So, you get this error message: Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer’s first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again. ..and sure, you could use -UseBasicParsing but, depending on your use case, you might then have to write […]

“Invalid provider type specified” CryptographicException when accessing the PrivateKey property of a certificate in C#/.Net

We recently encountered this in a production environment: A customer had installed a new certificate, and this exception began showing up in the logs. Luckily, the application was smart enough to at least fall back on using the previous (not yet expired) certificate, so no downtime occurred. Turns out the customer had been provided with […]

Docker starts slowly on Raspberry Pi / Raspbian

After installing the latest stable version of docker-ce (5:18.09.0~3-0~raspbian-stretch as of the time of writing), Docker would take ages to start after a reboot. Commands would even time out waiting for it. /var/log/daemon.log shows a gap of almost 4 minutes between the attempt to start the Docker Application Container Engine and the first log line […]

Reinstalling a used iMac (20-inch, Early 2008)

So, during spring cleaning, a used iMac was discovered at work. I figured it could be used for something, so I set it up on a table. It only booted to recovery mode, so I had to reinstall it. Simple, right? No, of course not! This is an Apple product. Apple ID needed So, booting […]

The trust relationship between this workstation and the primary domain failed

So, you resurrected a VM from the cold, damp crypts of the deepest backup dungeons, and now you can’t log in because the VM doesn’t trust the domain server anymore? That’s alright. The Windows Domain will rotate its keys from time to time, and an offline VM snapshot will not know about it. You don’t […]

Finding the first (default) IPv4 gateway in a Windows batch script

I recently had to whip out my Windows batch scripting skills to grab the default gateway for a routing script. Here’s what I ended up with: route print | findstr /R /C:”^[ ][ ]*0.0.0.0[ ]” | for /f “tokens=3” %%i in (‘more’) do (echo %%i & exit) >gw.tmpset /P gw=<gw.tmpdel gw.tmpecho “%gw%” This does, unfortunately, […]