fount of useless knowledge

systemd

Fedora 28: Enable NumLock on Login

I lost my primary drive on Friday, and I’m having to rebuild a bunch of stuff. I didn’t document minor things like this before, so I am this time around. Hopefully someone else finds this useful. numlockx There are plenty of different ways to enable NumLock on login, including a decent manual approach. An official X extension, numlockx, can handle it automatically for us. There’s an unofficial mirror available to build the package from source, or you can check for it in official channels.

  • CJ Harries
    CJ Harries
Syntax Highlighting in LaTeX with minted
minted

Syntax Highlighting in LaTeX with minted

This post serves as an introduction to minted, a pygments-based syntax highlighter for LaTeX. Adding pygments to LaTeX streamlines so many things. The post provides a few examples of things you can do with minted, details the installation process, and covers some basic security. Code Overview Installing Python pip pygments TeX Dependencies minted -shell-escape Useful features What’s Next Code You can view the code related to this post under the post-01-overview tag.

  • CJ Harries
    CJ Harries
TypeScript Decorators: Property Decorators
TypeScript

TypeScript Decorators: Property Decorators

This post takes an in-depth look at property decorators. It examines their signature, provides sample usage, and exposes a common antipattern. Reading the previous posts in the series is encouraged but not necessary. The Series so Far Code Overview Signature target: any propertyKey: string | symbol Usage Antipattern Example Solution Recap Legal The Series so Far Decorator Introduction JavaScript Foundation Reflection Parameter Decorators Property Decorators These posts are planned but not written yet:

  • CJ Harries
    CJ Harries
TypeScript Decorators: Parameter Decorators
TypeScript

TypeScript Decorators: Parameter Decorators

This post takes an in-depth look at parameter decorators. It examines their signature and provides a couple of useful examples. Reading the previous posts in the series is encouraged but not necessary. The Series so Far Code Overview Class Method vs Global Function Signature target: any propertyKey: string | symbol parameterIndex: number Usage required Arbitrary Metadata Recap Legal The Series so Far Decorator Introduction JavaScript Foundation Reflection Parameter Decorators Property Decorators Method Decorators Class Decorators Eventual Topics:

  • CJ Harries
    CJ Harries
TypeScript Decorators: Reflection
TypeScript

TypeScript Decorators: Reflection

This post takes a cursory look at reflection with TypeScript. Its primary focus is how reflection can be used with TypeScript decorators. It introduces Reflect, reflect-metadata, and some miscellaneous related components. The Series so Far Code Overview Reflect emitDecoratorMetadata reflect-metadata Example: Validate a Parameter Range Recap Legal The Series so Far Decorator Introduction JavaScript Foundation Reflection Parameter Decorators Property Decorators Method Decorators Class Decorators Eventual Topics: Where Decorators Work Decorating Instance Elements vs.

  • CJ Harries
    CJ Harries
TypeScript Decorators: JavaScript Foundation
TypeScript

TypeScript Decorators: JavaScript Foundation

This post looks at how TypeScript compiles decorators. It pulls the raw JavaScript from the compiler and breaks down the result. It has basic decorator examples of each type to examine the JavaScript output. The Series so Far Code Why Look at the JavaScript? Configuration From the Source Raw Prettified and Polished Analysis Parameter Decorators Property Decorators Method Decorators Class Decorators Recap Legal The Series so Far Decorator Introduction JavaScript Foundation Reflection Parameter Decorators Property Decorators Method Decorators Class Decorators Eventual Topics:

  • CJ Harries
    CJ Harries
TypeScript Decorators: Introduction
TypeScript

TypeScript Decorators: Introduction

This post serves as introduction to TypeScript decorators. It looks at basic decorators, decorator factories, and decorator composition. You should have some familiarity with TypeScript and some object-oriented programming experience. The Series so Far Code Decorators Configuration Simple Example Decorator Factories Composition Recap Legal The Series so Far Decorator Introduction JavaScript Foundation Reflection Parameter Decorators Property Decorators Method Decorators Class Decorators Eventual Topics: Where Decorators Work Decorating Instance Elements vs. Static Elements Examples Pairing Parameter Decorators with Method Decorators Pairing Property Decorators with Class Decorators Code You can view the code related to this post under the post-01-decorator-intro tag.

  • CJ Harries
    CJ Harries
SSH Agent Forwarding Vulnerability and Alternative
ssh

SSH Agent Forwarding Vulnerability and Alternative

One of the things that I really like about ssh-agent is its ability to forward itself to remotes. By sending the agent instead of setting keys on each box, I’m locking down access to a few machines that I know and trust. It’s amazingly convenient and has saved me so much headache. As I was doing research for a previous post, I kept seeing hints that maybe forwarding the agent isn’t actually a very good idea.

  • CJ Harries
    CJ Harries
Manage Many Keys with SSH Config and KeePass
KeePass

Manage Many Keys with SSH Config and KeePass

I’ll be the first to admit my security has room for improvement. Until last year, I was reusing passwords intermixed with a terribly simple mnemonic. Until a few months ago, my phone and computer were totally unencrypted. I’ve been fighting the change because it’s scary. I’m also very lazy and have been dreading the extra work involved with good security. I’ve put off updating SSH credentials for about two years now for that exact reason.

  • CJ Harries
    CJ Harries
gitflow Subfeatures with gitflow-avh
gitflow

gitflow Subfeatures with gitflow-avh

I’m a huge fan of gitflow. It’s made my life much easier. However, I’ve noticed recently that, as the codebase grows, features can become disorganized or unwieldy. gitflow-avh solves this problem incredibly well by allowing features to be based off any branch. Note Code Problem Feature Per Item Two Features One Feature Solution Installation Using Subfeatures Problem Solved with Subfeatures Note This is not a gitflow overview. Check out the original branching model and the gitflow repo for more information on those.

  • CJ Harries
    CJ Harries
Installing wxPython 4.0 (Project Phoenix) on Fedora 27
wxPython

Installing wxPython 4.0 (Project Phoenix) on Fedora 27

I’ve stayed away from wxPython in the past because updates were slow and Python 3 wasn’t supported. Within the last couple of weeks, 4.0 was completed, which at least answers the Python 3 problem. I’ve been pounding my head against X11 idiosyncracies all weekend, so I thought I’d take a break and try it out. Dependencies It looks like the prequisites were sourced from Debian. $ sudo dnf install -y {dpkg,freeglut,gstreamer{,1}-plugins-ba{se,d-free},gtk3,lib{jpeg,notify,SM,tiff},python{2,3},SDL}{,-devel} @development-tools

  • CJ Harries
    CJ Harries
rofi: Matching and Sorting
rofi

rofi: Matching and Sorting

This is the fifth in a series of several posts on how to do way more than you really need to with rofi. It’s a neat little tool that does so many cool things. I don’t have a set number of posts, and I don’t have a set goal. I just want to share something I find useful. This post looks at configuring rofi’s matching and sorting. Assumptions Code Overview Comparison Basic Sort Config (Yet Another) rofi Options Script Full Script Change Matching and Sorting Via a modi Assumptions I’m running Fedora 27.

  • CJ Harries
    CJ Harries
rofi: Change Window Location
rofi

rofi: Change Window Location

This is the fourth in a series of several posts on how to do way more than you really need to with rofi. It’s a neat little tool that does so many cool things. I don’t have a set number of posts, and I don’t have a set goal. I just want to share something I find useful. This post looks at changing rofi’s window location. It also introduces some rofi dmenu usage to handle input and ends with a introduction to script modi.

  • CJ Harries
    CJ Harries
rofi: Overview and Installation
rofi

rofi: Overview and Installation

This is the first in a series of several posts on how to do way more than you really need to with rofi. It’s a neat little tool that does so many cool things. I don’t have a set number of posts, and I don’t have a set goal. I just want to share something I find useful. This post provides a rofi overview and installation instructions. Assumptions Code Overview Installation Dependencies Source Code Options Standard Debuggable Easy Mode Full Script Assumptions I’m running Fedora 27.

  • CJ Harries
    CJ Harries
Sensible SSH with Ansible: An Ansible Primer
Sensible SSH with Ansible

Sensible SSH with Ansible: An Ansible Primer

This is the third in a series of several posts on how to manage ssh via Ansible. It was inspired by a warning from Venafi that gained traction in the blogosphere (read: my Google feed for two weeks). I don’t know many people that observe good ssh security, so my goal is to make it more accessible and (somewhat) streamlined. This post serves as an Ansible primer. It assumes shell knowledge but nothing else.

  • CJ Harries
    CJ Harries
Cursor Detection Run Time Analysis
Automation

Cursor Detection Run Time Analysis

This is a quick follow-up to an earlier post today. I don’t have much to add, just more code and some (basic) graphs. Direct Xlib usage is seriously the way to go. Code Script Runner Raw Data Munging Setup pyautogui-pixel-color.py xlib-color.py xwd-convert-chained.py xwd-convert.sh All Together Slow Only Conclusions Code You can find everything here in the repo. Script Runner To get some data, I had to revamp most of the scripts from the first post.

  • CJ Harries
    CJ Harries
Quickly Detect Cursor Position and Color
Automation

Quickly Detect Cursor Position and Color

I’ve been absolutely thrilled moving my home dev world back to Fedora. I’m not fighting OS ads, virtualization just works, and my settings actually stay the same after updates. I am, however, missing AutoHotkey. It’s been an integral part of my computing world since undergrad. I’ve spent the better part of three years looking for a POSIX AHK clone with no luck. I’ve tossed around the idea of starting something similar for some time now.

  • CJ Harries
    CJ Harries
CLI

Remove Consecutive Duplicate Lines With awk

I ran into an interesting problem yesterday. At some point, while scripting updates to a collection of repos, I managed to duplicate a few lines in several files. I ended up with something like this: README.md 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 # `dotfiles-role-javascript` # `dotfiles-role-javascript` [![Build Status](https://travis-ci.org/thecjharries/dotfiles-role-javascript.svg?branch=master)](https://travis-ci.org/thecjharries/dotfiles-role-javascript) [![GitHub tag](https://img.shields.io/github/tag/thecjharries/dotfiles-role-javascript.svg)](https://github.com/thecjharries/dotfiles-role-javascript)

  • CJ Harries
    CJ Harries
Let's Encrypt from Start to Finish: Automating Renewals
Let's Encrypt from Start to Finish

Let's Encrypt from Start to Finish: Automating Renewals

This is the sixth in a series of several posts on how to do way more than you really need to with Let’s Encrypt, certbot, and a good server. I use all of these things regularly but I’ve never taken the time to take them apart, look at how they work, and spend hours in Google trying in vain to figure out how to put them back together. It was inspired by a disturbing trend of ISP privacy violations and the shocking regulatory capture of the US Federal Communications Commission.

  • CJ Harries
    CJ Harries
Let's Encrypt from Start to Finish: Generating and Testing a Cert
Let's Encrypt from Start to Finish

Let's Encrypt from Start to Finish: Generating and Testing a Cert

This is the fifth in a series of several posts on how to do way more than you really need to with Let’s Encrypt, certbot, and a good server. I use all of these things regularly but I’ve never taken the time to take them apart, look at how they work, and spend hours in Google trying in vain to figure out how to put them back together. It was inspired by a disturbing trend of ISP privacy violations and the shocking regulatory capture of the US Federal Communications Commission.

  • CJ Harries
    CJ Harries
Let's Encrypt from Start to Finish: Useful Headers
Let's Encrypt from Start to Finish

Let's Encrypt from Start to Finish: Useful Headers

This is the fourth in a series of several posts on how to do way more than you really need to with Let’s Encrypt, certbot, and a good server. I use all of these things regularly but I’ve never taken the time to take them apart, look at how they work, and spend hours in Google trying in vain to figure out how to put them back together. It was inspired by a disturbing trend of ISP privacy violations and the shocking regulatory capture of the US Federal Communications Commission.

  • CJ Harries
    CJ Harries
Let's Encrypt from Start to Finish: Tuning with OpenSSL
Let's Encrypt from Start to Finish

Let's Encrypt from Start to Finish: Tuning with OpenSSL

This is the third in a series of several posts on how to do way more than you really need to with Let’s Encrypt, certbot, and a good server. I use all of these things regularly but I’ve never taken the time to take them apart, look at how they work, and spend hours in Google trying in vain to figure out how to put them back together. It was inspired by a disturbing trend of ISP privacy violations and the shocking regulatory capture of the US Federal Communications Commission.

  • CJ Harries
    CJ Harries
Let's Encrypt From Start to Finish: First Steps
Let's Encrypt from Start to Finish

Let's Encrypt From Start to Finish: First Steps

This is the second in a series of several posts on how to do way more than you really need to with Let’s Encrypt, certbot, and a good server. I use all of these things regularly but I’ve never taken the time to take them apart, look at how they work, and spend hours in Google trying in vain to figure out how to put them back together. It was inspired by a disturbing trend of ISP privacy violations and the shocking regulatory capture of the US Federal Communications Commission.

  • CJ Harries
    CJ Harries
Chrome Remote Debugging on Windows
Google Chrome

Chrome Remote Debugging on Windows

I’ve had trouble with this before, apparently, so this time I’m documenting the process. The official Google docs leave out a couple of setup steps, which is seriously frustrating. Drivers Install the Android Debug Bridge Fast Installation Manual Installation Enable USB Debugging Launch adb Access in DevTools Sources Environment Drivers You’ll need to find your OEM USB drivers and install them. Device Manager should report the correct device when connected:

  • CJ Harries
    CJ Harries
Let's Encrypt from Start to Finish: Overview
Let's Encrypt from Start to Finish

Let's Encrypt from Start to Finish: Overview

This is the first in a series of several posts on how to do way more than you really need to with Let’s Encrypt, certbot, and a good server. I use all of these things regularly but I’ve never taken the time to take them apart, look at how they work, and spend hours in Google trying in vain to figure out how to put them back together. It was inspired by a disturbing trend of ISP privacy violations and the shocking regulatory capture of the US Federal Communications Commission.

  • CJ Harries
    CJ Harries
2017 Music
music

2017 Music

I missed writing about music. Clicking on the album covers should take you somewhere to find out more about the album. I’ve compiled this list into a quick Spotify playlist. New Albums Converge - The Dusk In Us Zao - Pyrrhic Victory Comeback Kid - Outsider Perturbator - New Model Insane Power - Silent Old Albums Run the Jewels - RTJ 3 XavlegbmaofffassssitimiwoamndutroabcwapwaeiippohfffX - Gore Evergreen Terrace - Dead Horses Desolated - The End GosT - Behemoth New Albums This is the first year I haven’t had slam in my top five since probably 2012.

  • CJ Harries
    CJ Harries
Wizards of the Web

Housekeeping: December 2017

Sensible SSH with Ansible was delayed by a flood of yak shaves, but it’s still (mostly) in active development. I’ll be shaking down a new tool over the course of Let’s Encrypt from Start to Finish; it’s the most involved yak shave from Sensible SSH. Let’s Encrypt from Start to Finish will most likely be finished and published in its entirety by the end of this week (possibly next week; probably next week; I’m guessing next week).

  • CJ Harries
    CJ Harries
The certbot Hook API
certbot

The certbot Hook API

Hopefully this is useful to someone else. I got confused by the language change from renew to deploy hooks and spent some time ripping the code apart to see how the hooks actually work. I’ve broken down where the hooks are defined, their configuration, and how you can modify them. Notes Overview Initial Change CLI Hook Definitions Execution Current API CLI External Hooks Hook Definitions Execution So What? Expect Change Manually Run Hooks After Initial Creation Create a Generic Server Restart Hook Nginx Apache Pre- and Post-Hooks are Always Run Final Note Notes When I started this, certbot was on 0.

  • CJ Harries
    CJ Harries
Package Manager Showdown: Yarn and NPM on a VPS
NPM

Package Manager Showdown: Yarn and NPM on a VPS

I’ve worked pretty hard to stay out the whole JS package manager debate. NPM’s always done what I needed. Prior to yesterday evening, I had no baseline for comparison. Sure, like everyone else, I’ve read articles that point out how slow NPM is in comparison to Yarn. I tend to switch tabs/windows/whatever the second I forget what I was doing (i.e. every five minutes), so I don’t often wait on NPM.

  • CJ Harries
    CJ Harries
git

Update Repo Badges Automatically: Preview

After a day of furious coding and way more debugging, I think I finally have a collection of git hooks that will properly update badge references. Check out the repo; it’s still pretty raw. I’ve manually tested it with both vanilla and git-flow (if you’re not using git-flow, use it). I’ll actually flesh out the code later; for now, I’m really excited and wanted to share. Repo badges are pretty neat.

  • CJ Harries
    CJ Harries
Ubuntu Notes: Unlocking /var/lib/dpkg
Vagrant

Ubuntu Notes: Unlocking /var/lib/dpkg

I ran into some issues this morning setting up a Xenial box via Vagrant. On boot, /var/lib/dpkg was totally locked with nothing I knew to link it to in ps aux. I’ve created a fairly novel solution; my point today was to learn about something new. You should have a basic familiarity with the Linux CLI. If you don’t know what systemd is, that’s not a big deal. Skip to my take on a full solution if you’d like, but make sure to read the disclaimer first.

  • CJ Harries
    CJ Harries
Sensible SSH with Ansible: Vagrant Setup
Sensible SSH with Ansible

Sensible SSH with Ansible: Vagrant Setup

This is the second in a series of several posts on how to manage ssh via Ansible. It was inspired by a warning from Venafi that gained traction in the blogosphere (read: my Google feed for two weeks). I don’t know many people that observe good ssh security, so my goal is to make it more accessible and (somewhat) streamlined. This post looks at how to quickly and easily mimick common environments in Vagrant.

  • CJ Harries
    CJ Harries
Sensible SSH with Ansible: Overview
Sensible SSH with Ansible

Sensible SSH with Ansible: Overview

This is the first in a series of several posts on how to manage ssh via Ansible. It was inspired by a warning from Venafi that gained traction in the blogosphere (read: my Google feed for two weeks). I don’t know many people that observe good ssh security, so my goal is to make it more accessible and (somewhat) streamlined. The Series so Far Code Executive Summary Note Compiling the Series Posts Software Main Windows My Environment Tool Overview ssh Ansible Optional: Vagrant The Series so Far Overview (This section should get updated as series progresses.

  • CJ Harries
    CJ Harries
JavaScript

Deconstructing Epom Ads for Personal Edification

Completely unrelated setup Disclaimer Curiousity DIY So what? Lock your iframes Never trust the client Completely unrelated setup I’m very interested in automating small, repetitive tasks that I don’t want to do. I’m well known for this at work, and AutoHotkey has come up a bunch recently because of a slew of new unskilled, repetitive computer tasks. My work environment is totally Linux and I’ve been playing through my “needed a better GPU” Steam backlog at home, so my AHK is a little rusty.

  • CJ Harries
    CJ Harries
NPM Lifecycle Stages: A Study in Stream Editors
NPM

NPM Lifecycle Stages: A Study in Stream Editors

A majority of my work, both business and pleasure, is done in Node. I support a fairly large codebase which always needs maintenance. As I get new ideas or learn new techniques, the codebase grows. No matter how organized I try to be, every project seems to spawn half a dozen new projects. New projects means new config and packages and builds and instead of doing things the right way, I’ve just been shuffling a few master files around.

  • CJ Harries
    CJ Harries
Docker in WSL
Windows

Docker in WSL

Being able to run a Docker host natively in Windows would be awesome. Being able to interact with it via WSL would be even more awesome. I’ve pieced together both a native and bespoke solution. The native solution comes mostly from Docker and Windows docs. The bespoke solution is wired up using the preview version of LinuxKit. Code Note Native Solution Native Requirements Inside Windows IMPORTANT dockerd From Docker Aside: Things That Didn’t Work Initially Settings Inside WSL Configure python Install pip Install docker-compose Environment Just Kidding Mostly Bespoke Solution Bespoke Requirements A Word of Caution Inside Windows Installation Bootstrapping Lifecycle Inside WSL Final Notes Code Note I use both PowerShell and Bash throughout this post.

  • CJ Harries
    CJ Harries
KeePass + ssh
KeePass

KeePass + ssh

I’ve been using KeePass Professional Edition for a few months now, and I’m always discovering new things to do with it. For example, I’ve got HQ photos of my driver’s license so that I can go to the gym without carrying my full wallet (if that’s illegal I totally don’t do that). I’ve got a couple of shared databases that sync off my main personal database that I can share with family and friends, which means I change update my accounts without the old hassle of texting everyone the new credentials.

  • CJ Harries
    CJ Harries
KeePass + FreeRDP
KeePass

KeePass + FreeRDP

One of my primary work responsibilities is to handle the Linux environments not related to our ecommerce platform (although, as one of few devs, one of my primary responsibilities is basically everything). We’re a big fan of the RHEL pipeline, so I use CentOS as my work environment. It bites occasionally, but, by and large, we don’t run bleeding-edge stacks because they’re, well, unsupported bleeding-edge stacks. I can find most of the software I need with older versions of Fedora or by just manually building things.

  • CJ Harries
    CJ Harries