Posts

Helm-grep project refactoring: search and replace

With this you can readily search an entire project directory for some text, and then make whole-scale changes to any or all files containing that text. I assume you already have helm-projectile installed and you use it; if not, you’re missing out! First, install wgrep and helm-wgrep, for which I use use-package and my emacs.el init file: (use-package wgrep :ensure t :config (use-package wgrep-helm :ensure t)) Then, execute helm-projectile-grep for the text you desire.

New Screenshot tool: Flameshot

Flameshot is an excellent new screenshot tool to replace Spectacle, the default KDE tool that served me for years until the latest round of software updates. Suddenly out a screenshot utility for my exwm setup, Flameshot more than impressed me with its rapid editing functionality in addition to the nuts-and-bolts screenshots. Then implementing it into my exwm and binding to my printscreen key was easy: (exwm-input-set-key (kbd "<print>") (lambda () (interactive) (start-process-shell-command "flameshot gui" nil "flameshot gui")))

Getting Twitter Media gif/videos to work

I was receiving the error “We cannot play the video in this browser. Please try a different web browser.” I noticed they worked in Chrome but not Firefox; in my experience this is because Firefox has some additional protections against non-free software that CHrome doesn’t care about. I identified that my browser was missing some codecs checking youtube and spotting the red-boxes under “what does this browser support?” Looking around I found this solution.

HP Printer disabled

Went to the cups interface (https://localhost:631) -> Printers -> TARDIS -> “Resume” I don’t know why it ended up paused. Trying all the system (non-cups) things to enable it, restarting many times, never fixed the problem.

Sweet Honeysql and Postgres

I thought I’d share a snippet of what I love about my HoneySQL + Postgres setup (this is plain Honey without the Postgres extras, which never seem to cover my needs). I don’t take any pride in the actual database model, which is in-use and was not well designed. Nonetheless, the two things that worked out nicely here are: table applications has a one-to-many relationship with validations, so PG’s “distinct on” was the perfect tool for just matching the most recent of an application’s validations.

Power Button management

https://www.reddit.com/r/i3wm/comments/58j1ui/how_to_intercept_the_power_button_to_avoid_brutal/ Note that you might want suspend instead of hibernate, if you want rapid resume. The power button isn’t handled by the window manager, it’s handled by systemd For example this is in my /etc/systemd/logind.conf [Login] HandlePowerKey=hibernate HandleLidSwitch=ignore IdleAction=suspend IdleActionSec=20min

Emacs multi-inbox Email Setup

I use the Emacs package Gnus (included in Emacs) to manage my email, and have used it this way for years. There are many reasons for managing your email locally, and even more for managing them in Emacs, but it took me years to make it through the obstacle course of actually figuring out how to do it. It requireed learning many new concepts that our day of webmail and Exchange-programs generally glosses over.

Extending HoneySQL with Array Intersection

Turns out that Postgres has beautiful support for “array” field types. In one database of mine, I use this to keep track of the recipients of emails: DROP TABLE IF EXISTS "email_log" CASCADE; CREATE TABLE "email_log" ( id SERIAL PRIMARY KEY, sender TEXT NOT NULL, recipients TEXT[] NOT NULL, message TEXT, sent_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, info JSONB); -- Note the recipients TEXT[] definition: that's an array of texts. Now for the use-case: a user might have multiple email addresses, and the email_log tracks recipient ADDRESSES not user-ids.

Extending HoneySQL with JSON operators

HoneySQL is a wonderful Clojure library that lets use the full power of Clojure collections to generate your SQL statements. Postgres supports json operators and data types, which is one of the main features for which I use it; however, since this is a non-SQL-standard feature, HoneySQL doesn’t support it directly, and I didn’t see that support in HoneySQL-Postgres yet. Fortunately, HoneySQL makes it easy to extend this way. (ns myapp.

Auto-mounting USB drives with EXWM

Use udiskie to auto-mount devices plugged in to your machine, such as flash drives. I found that trying to install it from my OpenSUSE packagemanager didn’t work, alhtough it was listed, but I already had pip installed and that led to simple process. After installation, the following worked beautifully: ~/.local/bin/udiskie --no-notify --tray & notifications did not play nice with exwm, but the tray works great. Then I just put the above into my .