katriel

misc thoughts and notes

Read this first

Secret Cabal meetings

I run a biweekly meetup for the staff+ engineers in my local organisation. A couple different folks asked about whether meetings like these have been worthwhile and how you might go about setting one up, so here is my approach. YMMV.

Overall, I’ve found these meetings to be pretty valuable in a couple of ways: they help build relationships between the staff+ engineers in the local org, serve as a social outlet where we can discuss things freely in a way that isn’t often possible with a wider audience, and act as a sort-of informal lightweight mentorship program where people share what’s worked for them in tough situations. It’s also sometimes useful as a bidirectional channel between engineers and Leadership that’s a little more direct than ad-hoc 1-1s.

invitees

We don’t have precise invitation criteria other than “staff+”, and the attendance list is a little fuzzy—it mostly overlaps...

Continue reading →


spotifyd

This is all pretty obvious, but recording it here for posterity. spotifyd is an open-source, lightweight Spotify client for Premium accounts. We use it for our home server, which runs a couple of instances to enable Spotify Connect to the home speakers.

Setup is pretty easy but requires a little systemd messing around. Step 1 is to clone the repo and build spotifyd (which needs Rust’s cargo), and then symlink it into /usr/bin. I’m using the pulseaudio backend, so the command to build is cargo build --release --features pulseaudio_backend. Step 2: write

[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd

[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12

[Install]
WantedBy=default.target

to /etc/systemd/user/spotifyd.service and chmod it to readable for everyone. Step 3: for each user that wants to run spotifyd...

Continue reading →


user pulseaudio

Michael and I have a home server running spotifyd (which is really a story for another post); each running a user systemd service to keep it up.

This seemed to confuse pulseaudio a little. The default ubuntu configuration runs one pulseaudio service per user, and only the “active user” gets to actually make sounds come out of the speakers. The definition of active user wasn’t entirely obvious; if someone was logged in to a graphical session then they got it, and otherwise it seemed to take turns based on who was actually playing.

Anyway, apparently it’s not recommended to run pulseaudio as a system user, mostly for security reasons, but as an Official Security Person I can clearly ignore all of these and just run it anyway. So, to get it working:

sudo systemctl enable pulseaudio
sudo systemctl start pulseaudio

then for each user that should play music, add that user to the audio and...

Continue reading →


fish history sync

I use fish in tmux with maybe two dozen shells open at a time, for various projects that I have hanging around. By adding

 history across fishes
function save_history --on-event fish_preexec
    history --save
end
alias hr 'history --merge'   read and merge history from disk
bind \e\[A 'history --merge ; up-or-search'

to ~/.config/fish/config.fish, reverse search now syncs across all history in all shells (or you can bring a shell up to date with all other shells using hr). That feels good.

View →


iButton hackery

To get in to various places around Oxford, many places use little iButton fobs, which run on the Dallas Semiconductors 1-Wire protocol. When you tap them against a “master” device, they broadcast their unique ID, which the master can then look up in its list of people.

iButton fob

Kevin and I decided that this was excessively simple, and that we should build something to read and impersonate these fobs. Fortunately, the 1-Wire protocol they use is relatively standard, and there’s already an Arduino library to handle them.

The circuit you need is simple: connect some pin to a 4.7k resistor, +5v power and the centre of the fob, and ground the outside. Then run the following and the serial monitor should spit out the unique ID of any iButton you tap.

include <OneWire.h>

// This is the pin with the 1-Wire bus on it
OneWire ds(PIN_D0);

// unique serial number read from the key
byte addr[8];

//
...

Continue reading →


Yosemite broke my git svn

Previously on Mavericks:

$ git svn rebase
Can't locate SVN/Core.pm in @INC (@INC contains: /usr/local/Cellar/git/1.8.4/lib /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.4 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/System/Library/Perl/Extras/5.16 .) at /usr/local/Cellar/git/1.8.4/libexec/git-core/git-svn line 41.

Solution: since the system Perl 5.16 contains SVN::Core, link it in from /Applications/Xcode.app/Contents/Developer/Library/Perl/5.16.

Now on Yosemite:

$ git svn rebase 
Can't locate SVN/Core.pm in @INC (you may need to install the SVN::Core module) (@INC contains: /usr/local/git/lib/perl5/site_perl
...

Continue reading →


zotero + emacs + latex = awesome

As a PhD student, I have to reference a lot of stuff, which I do with Zotero. It struck me a while ago that it would be nice if this integrated with my LaTeX editor of choice, and so I spent a morning doing just that. Now, I can add references straight from Firefox, and immediately add a BibTeX citation to them in Emacs with C-c [.

  1. Install Zotero and set it up.
  2. Install the fantastic AutoZotBib Zotero extension. Take care: it looks like a Firefox extension, but you install it from Zotero’s add-on menu not Firefox’s.
  3. Configure AutoZotBib to dump your Zotero library to a .bib file somewhere.
  4. Enable the RefTeX minor mode (which you should already have as part of Emacs). If using biber, you also have to tell RefTeX that \addbibresource gives the path to the bibliography.

    (add-hook 'LaTeX-mode-hook 'reftex-mode)
    (setq reftex-plug-into-AUCTeX t)
    (setq reftex-bibliography-commands
    ...

Continue reading →