Category Archives: Reference

Short references for personal… reference. Basically a howto for the tech-savvy.

Finding and killing stuck or mistyped postgresql queries

I’ve found these useful during development: Listing running queries: SELECT pid, now() – pg_stat_activity.query_start AS duration, query FROM pg_stat_activity WHERE state = ‘active’ AND pid <> pg_backend_pid(); Listing queries that have run for more than a full minute: SELECT pid, now() – pg_stat_activity.query_start AS duration, query FROM pg_stat_activity WHERE state = ‘active’ AND pid <> […]

Web Echo Service for developers

I recently had need of a service that would return your exact query to you for web client (or proxy) development purposes, in a case where using Fiddler, Wireshark, tcpdump et.al. was proving difficult for various reasons. The solution became the C-Net Echo Service, available at https://echo.c-net.org/ (and over plain HTTP if you need it). […]

Generating a C# library from swagger.json using Docker for Windows

Just a short reference for myself (and maybe for you). How to run Docker for Windows, mount a local file system drive inside of the container, grab the swagger.json file off of a URL, and generate a library: Using swagger-codegen-cli (old): docker run -it -v //c/temp/swagger:/local –network host –rm swaggerapi/swagger-codegen-cli generate -i “http://docker.for.win.localhost:5000/swagger/v1/swagger.json” -l csharp […]

Remote Desktop (RDP) to a computer that’s enrolled in Azure AD

If you attempt to connect to a machine that’s enrolled in Azure AD from a workstation that’s not part of the domain, like your desktop or laptop at home, you’ve likely encountered this issue. Firstly, we should get a few basics out of the way. You need a correct username and password. When your user […]

curl SSL fails even with ca-certificates installed

curl: (60) SSL certificate problem: unable to get local issuer certificateMore details here: https://curl.haxx.se/docs/sslcerts.html So curl fails to access sites over https, even if ca-certificates is installed in your Docker container? You need to force a certificate rehash. Why this is not done by default escapes me. /usr/bin/c_rehash curl should be happy now. Enjoy!

GLaDOS Voice Generator (weekend project)

I wanted some GLaDOS-like sounds for my home automation system. I found this project, which doesn’t work anymore as of writing, as the synthesis server is offline. Thus, my weekend project turned into a week-long evening project. But that’s fine, as the result is cool: The new GLaDOS Voice Generator is here! Enjoy.

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 […]

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 […]