Map Caps Lock to Control on Windows

March 25, 2023 - Reading time: ~1 minute

Caps Lock is not very useful for developers. Turn Caps Lock into another Ctrl key on Windows with a simple Registry hack.

Read more

SSL Dates Check Script

November 25, 2022 - Reading time: ~1 minute

An easy way to check certificate dates derived from the script from the SSL Test Script Post.

Read more

Password Protect a PDF Document

August 12, 2022 - Reading time: ~1 minute

I recently had the need to add a password to a PDF file while also locking it down, but I also needed to retain the ability to edit it myself. I didn't want to use anything like Adobe's PDF application and, obviously, preferred to use Open Source and the command line. After a little bit of searching, I found that the pdftk tools, which I already had installed, did exactly what I needed.

$ pdftk input.pdf output output.pdf owner_pw 'password1' user_pw 'password2'

Two passwords are set: The owner's password protects the document and allows the owner to edit it. The user's password protects the document and also locks it down. Perfect.


Cleaning Up Ubuntu

May 16, 2022 - Reading time: ~1 minute

Here are some ways to clean up an Ubuntu installation

  1. Clean APT cache
    sudo apt clean
  2. Remove old, unused packages
    sudo apt autoremove [--purge]
  3. Use baobab to find large files

Ubuntu Package Holding

April 24, 2022 - Reading time: ~1 minute

Sometimes you make some changes to your system and you just know that something will break if a certain package gets updated. You want to keep that certain package from updating until you're ready for it.

In Ubuntu, or any apt/dpkg based system, you can tell apt to just hold the current package version using apt-mark hold. For example, let's say that if the xxd package gets updated, it will break something for some reason. Tell apt not to update it.

$ sudo apt-mark hold xxd

When you're ready to start updating it again, tell apt that it can update it:

$ sudo apt-mark unhold xxd

It's that simple. If you ever want to check what packages are currently in hold status, there are two ways to do it.

$ dpkg --get-selections | grep "hold"
xxd                                             hold
$ apt-mark showhold
xxd

Cockpit/Apache Reverse Proxy Setup

March 14, 2022 - Reading time: ~1 minute

I had a hard time finding the information I needed to get Cockpit to work right behind an Apache reverse proxy setup. So, I decided to collect everything I found here for the future.

At first, I tried to setup cockpit under the /cockpit path but it kept failing. Apparently, that path is reserved by Cockpit, so I switched to using /ckpt/ instead.

  1. Create config file: /etc/cockpit/cockpit.conf
  2. Add contents:
    [WebService]
    Origins = https://mydomain.com http://127.0.0.1:9090
    ProtocolHeader = X-Forwarded-Proto
    AllowUnencrypted = true
    UrlRoot = /ckpt/
  3. Restart Cockpit
  4. Add Apache directives to chosen VirtualHost:
    ProxyPreserveHost On
    ProxyRequests Off
    SSLProxyVerify None
    SSLProxyCheckPeerCN Off
    SSLProxyCheckPeerName Off
    SSLProxyCheckPeerExpire Off
    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /ckpt/(.*) ws://127.0.0.1:9090/ckpt/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /ckpt/(.*) http://127.0.0.1:9090/ckpt/$1 [P,L]
    ProxyPass /ckpt/ http://127.0.0.1:9090/ckpt/
    ProxyPassReverse /ckpt/ http://127.0.0.1:9090/ckpt/
  5. Restart Apache

Categories