Emacs systemd service

Since upgrading to Ubuntu 15.04, I’ve been living with systemd. I’ve been a Debian user mainly and was wary of the doom-and-gloom comments about systemd but actually, I’ve been a bit impressed with it so far. One thing that is undeniably easier with systemd is writing what System V init sytems called init scripts. In systemd they are known as service files.

Anyway, I usually run emacs as daemon and I had the idea that emacs could run as a systemd service! Immediately I fell into the trap that Umberto Eco describes:

there are two laws no human being can escape: the first idea that comes into a person’s mind will be the most obvious one; and, having had an obvious idea, nobody ever thinks that others may have had the same idea before.

So yes, there plenty of systmed emacs service files out there, but this one is mine.

Description=Emacs daemon
After=syslog.target network.target

ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
Environment=SSH_AUTH_SOCK=/run/user/1000/keyring/ssh GPG_AGENT_INFO=/run/user/1000/keyring/gpg:0:1


The main difference from my config is that I’ve added the GPG_AGENT_INFO data so that emacs can uses GPG agent. I run keychain so my ssh-agent and gpg-agent are launched at login. There are probably nicer ways to pass the environment variables. This only works if you user ID is 1000, which it most likely will be if you are the first user. Just check the output of id -u and change the 1000 to whatever it says and it will probably work.

Lastly, I run this service as a user so I put the file in ~/.config/systemd/user/emacs.service and then did:

systemctl --user enable emacs.service   
systemctl --user start emacs.service

I use emacsclient to connect to the server, which I’ve aliased to just e, so I’ll type e -nc to open a new instance for example.

discerptor, n.

A person who pulls something apart; a person who divides or separates something.


Brit. /dɪˈsəːptə/ , U.S. /dᵻˈsərptər/
Etymology: Probably partly < post-classical Latin discerptor person who separates something (1748 in the passage translated in quot. 1854; already in 14th cent. in sense ’adversary’), and partly directly < classical Latin discerpt-, past participial stem of discerpere discerp v. + -or suffix.(Show Less)

Now rare.

Source OED.

List of books that I’ve started but want to finish

  • The Glass Cage, Nicholas Carr
  • Armada, Ernest Cline
  • The Internet is not the Answer, Andrew Keen
  • Future Crimes, Marc Goodman
  • Hieroglyph: Stories and Visions for a Better Future, Ed Finn and Kathlyn Cramer
  • Hacker, Hoaxer, Whistle-Blower, Spy, Gabriella Coleman
  • The Age of Cryptocurrency, Paul Vigna
  • Seveneves, Neal Stephenson
  • Station Eleven, Emily St. John Mandel
  • The Story of Alice, Robert Douglas-Fairhurst
  • Surveillance after Snowden, Lyon
  • No Future for You: Salvos from The Baffler, John Summers, ed.
  • In Xanadu, William Dalrymple
  • Infinite Jest, David Foster Wallace
  • Countdown to Zeroday, Kim Zettler
  • Trigger Warning, Neil Gaiman

From, The Novel in Analog: Joshua Cohen’s Book of Numbers

As Cohen’s work reminds us, printed books are mostly private pleasures, lonely ones even. Unlike so much media today, they don’t target, watch, or measure us; they don’t flatter us with personalized stories based on accumulated data profiles (not yet, at least). But even as this essentially analog quality has convinced us that novels are doomed to be political dead zones, it has become one of their newfound attractions. “If you’re reading this on a screen, fuck off,” goes Book of Numbers’ opening line.

nomnomnom — regularly eat your cookies from Chromium

Cookies on websites both suck and are incredibly useful. They are useful because it’s convenient to not have to re-enter usernames and other stateful pieces of data. They suck because cookies are used to track you and they remember things that the website considers useful but you may not.

By the way, if you don’t have the EFF’s Privacy Badger extension installed, go install it. Privacy badger does care.

Let’s say you like to read the NYTimes but you may find that the 10 article limit per month to be a bit restrictive. After all, you go to your local library and read the gray lady there but sometimes well, you also re-read them online. But instead of reading the article you receive a bunch of indistinguishable-from-malware popups about reading more than 10 articles per month. How to get rid of them?

Well, you can just go clear your cookies in Chrome/Chromium. But chrome stores cookies in a SQLite database so you could make a script to go into the database, and remove offending entries. If you were to go and do that, say on Linux, you might end up with a SQL file like this:

delete from cookies where host_key LIKE '%nytimes%';

If that file was called nomnomnom.sql, you could have a script called nomnomnom.sql that did

sqlite3 $CHROME_COOKIES < ~/bin/nomnomnom.sql

Then you could add this to your crontab to say, get rid of the nytimes cookies everyday. As an example.

A list of random things going on in my life

A list of random things going on in my life

It’s been a while since I published anything personal on here. Not that I ever really did that, but I’ve been having some blogging guilt lately. I present the following unorganized list of things going on which you may, or more likely may-not find interesting. I tend to get introspective around birthdays that are divisible by five. This is a complete random collection of items. You have been warned.

Continue reading “A list of random things going on in my life”