• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Mikey Boldt

What am I doing?

  • Home
  • About Mikey
  • Contact

Recover from Blank Screen After Unplugging External Display in XFCE

February 26, 2016 by Leave a Comment

I’ve been loving the XFCE desktop environment, but one annoyance I have is this: on my laptop, if I’m using only an external monitor and unplug it, XFCE doesn’t automatically turn the laptop screen back on, and I’m left with no display.

In this state, I can switch to a different virtual console with, e.g., Ctrl + Alt + F1. I had hoped a simple xrandr -d :0 --auto would have fixed it, but I kept getting messages like Configure crtc 0 failed. As I found from this forum thread, the trick is you need to have the display active, so something like chvt 7; sleep 2; xrandr -d :0 --auto will work.

What a pain! I don’t want to switch to a virtual console, log in, and run some series of commands just to get my X display back.

Then it dawned on me: just add a keybinding to run the xrandr command. I keep my keybindings in my xmonad window manager configuration, so I added this:

,((modMask, xK_F7), spawn "xrandr --auto")

Now I can recover from this black screen annoyance with a simple key combination.

Filed Under: Tech Tagged With: display, xfce, xrandr

Remove a Key Binding From Emacs Mode

January 5, 2016 by Leave a Comment

I am experimenting with Gnu Global to navigate a Java project in emacs with the ggtags package. I find it fast and slick, but I hit a bump in the road when I found that it remaps M-< and M-> — the default bindings to jump to the top and bottom of a buffer — when there are multiple matches for a tag. I find this intolerable. Don’t whack useful key bindings. </rant>

Luckily, this is emacs and I can customize everything. I think this is the first time I have deleted key bindings, so I figured I’d document it. A quick search found a post on Emacs Redux which includes how to remove emacs key bindings. In short, set the mode map entry for the key binding you want to remove to nil. Here is what I added:

;; ggtags: don't whack my useful key bindings!
(eval-after-load 'ggtags
  '(progn
     (define-key ggtags-navigation-map (kbd "M-<") nil)
     (define-key ggtags-navigation-map (kbd "M->") nil)))

Filed Under: Tech Tagged With: emacs, gnu global, key bindings

Disable Bluetooth on Ubuntu Startup

September 17, 2014 by Leave a Comment

I don’t typically use Bluetooth, so I went looking for a setting to disable it on Ubuntu startup. After finding nothing, I turned to Google. Google found many ways, none of which seemed very friendly (things like sudoedit /etc/... to add a line to kill the service after it started, or add the kernel module to a blacklist, etc.). Then I came across a way to stop the Ubuntu Bluetooth service from being started by adding an override to the init script:

sudo sh -c "echo 'manual' > /etc/init/bluetooth.override"

This is so much cleaner than the other ways; the service never starts, no config files are edited, and the module is still loaded for the rare case I do need Bluetooth.

Filed Under: Tech Tagged With: bluetooth, ubuntu

Geequie: Cull Photos on Linux

December 17, 2013 by Leave a Comment

I recently decided to take advantage of Google’s automatic photo and video backup. Previously, I was using Sweet Home to synchronize them to my computer. I’m happier to have them in the cloud so I don’t have to worry about offsite backups, etc.

I took this opportunity to do a quick culling of my photos. I started off simply using the Nautilus file browser to view thumbnails and delete the cruft. I got annoyed with the nested directory structure of my photos, so I wrote a perl script to flatten it. After that, I found the thumbnails in Nautilus too small, so I started looking for other tools.

That’s when I discovered Geeqie. I fired it up in my photo directory, and I quickly figured out how to efficiently cull my photos. The key was using Geeqie’s marking capability, where you can “mark” photos with numbers 1–5. I simply used the up and down arrows to navigate through the photos, and marked photos I wanted deleted with mark 1 (by pressing the 1 key). To make the marks visible, I enabled the “Show Marks” option in the Select menu. After going through all the photos, I selected all photos with mark 1 (Ctrl + 1), deleted them (Ctrl + d), done!

Geequie made culling photos on my Linux machine a breeze!

Filed Under: Tech Tagged With: cull, geeqie, linux, photo, software

Sync PDFs with Android using Dropsync

November 27, 2013 by Leave a Comment

I recently got a Nexus 7, using it mainly to read academic papers. Often, I find an interesting article on my laptop, and want to stash it to my Android device to read later. I need this to be fully automatic–I am horrible at regularly doing manual synchronizations. Here I will describe the tools and workflow I use to synchronize PDFs from my laptop to my Android device.

I thought Dropbox would be all I needed. I already use it for synchronizing other files between computers. I thought I could just stick files in my Dropbox folder on my laptop, and have it automatically synchronized to my tablet. However, the Dropbox Android app does not automatically store files to the tablet; it just provides access to them when online. So, I searched for a tool to fill this hole.

Luckily, I found Dropsync, a full two-way sync Android client for Dropbox. It was very easy to set up (pick an SD card directory, pick a Dropbox directory, and it keeps them synchronized). I haven’t noticed any impact on battery life or performance of my tablet. Dropsync fits my needs perfectly.

Not related to synchronization, but the best Android PDF reader/annotator I’ve found is ezPDF Reader. In my opinion, its killer feature is its ability to zoom in just right. In a two-column paper, it zooms to fit one column perfectly in the width of the screen. When you get to the bottom of a column, a page flip gesture brings you to the next column. It fixes the zoom level for figures. In short, it does the Right Thing.

Filed Under: Tech Tagged With: android, dropbox, dropsync, ezpdf reader, nexus 7, papers, pdf

Configure .htaccess. to use FastCGI for PHP

December 10, 2012 by Leave a Comment

Introduction

I had a request to use FastCGI for PHP handling on a wordpress site, to fix permissions issues. That is, FastCGI runs the PHP scripts as the owner instead of the apache user. This plays more nicely with e.g. file uploads and script-generated files. Here’s a link for More info on PHP handlers.

The configuration was a little tricky, and I didn’t find a single site that laid it all out easily. Here are the steps:

Ensure mod_fcgid is loaded

Check that this line appears in httpd.conf:

LoadModule fcgid_module /usr/lib/httpd/modules/mod_fcgid.so

Create a wrapper script

I don’t fully grok it, but mod_fcgid must run the CGI scripts using suexec. suexec expects everything it runs to be inside the its document root. This document root can be found by running the command (as root):

/usr/sbin/suexec -V

and looking for the value of AP_DOC_ROOT. Mine is /var/www.

So, we make a wrapper script for the PHP CGI handler underneath the document root. We can set other relevant variables in there. Here’s an example, which I put in /var/www/cgi-bin/php-fastcgi:

#!/bin/sh
PHPRC=/etc/
export PHPRC # php.ini directory.
export PHP_FCGI_MAX_REQUESTS=5000 # Num requests before restarting process.
export PHP_FCGI_CHILDREN=8
exec /usr/bin/php-cgi # Call the regular PHP handler.

Update .htaccess settings

Now, we tell the web server ot run PHP scripts using fcgid:

AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /var/www/cgi-bin/php-fcgi .php

I believe this can also be done in httpd.conf, but this was my solution.

Done

We can see that it worked by looking at the “Server API” line in phpinfo(); it should have changed from e.g. “Apache 2.0 Handler” to “CGI/FastCGI”.

Filed Under: Tech Tagged With: apache, fastcgi, htaccess, mod_fcgid, php

Process Management in Emacs with proced

July 23, 2012 by Leave a Comment

Leaving emacs frustrates me, especially when it’s for things I would normally do in a command shell. But alas, I would regularly drop into a shell to run the top command, as I did not know of an emacs replacement. I became fed up enough with this to do some googling, and found proced, which is a dired-like mode for managing processes.

I haven’t done much with it yet, just looked at processes and killed an xeyes as a test. It seems to have common keybindings: g to update the buffer, q to bury the buffer, marking like dired, etc. It doesn’t seem to have a home on the internets or an info page, but M-x proced [enter] C-h m provides good documentation. Glad to have this new-to-me tool in my belt.

Filed Under: Tech Tagged With: emacs, proced, processes, top

Linking to MS Office File in Emacs Org Mode

July 18, 2012 by 3 Comments

My daily workflow includes emacs org mode files for each project I’m working on. I often link to files, programs, etc. from these org mode files. I tried linking to a MS Excel spreadsheet using my usual

file:/path/to/file.xlsx

link. However, since the xlsx file is really a zip file, emacs opened a dired buffer revealing the contents, rather than opening it in Excel.

After a bit of googling, I found a message from the org mode mailing list about linking to Excel and Word documents from org mode and discovered the file+sys link type. This, per the org mode External Links manual, will “open via OS, like double-click”, which is exactly what I want. Good reminder for myself: when all else fails, RTFM.

Filed Under: Tech Tagged With: emacs, msoffice, orgmode

Upgrade to Ubuntu 12.04 Precise Pangolin

June 4, 2012 by Leave a Comment

Introduction

I upgraded to Ubuntu 12.04 today. My motivation for upgrade was twofold:

  • Take advantage of the improved support for my wireless card in the 3.2 kernel. My MacBook Pro BCM4331 wireless adapter needed some love in earlier kernels. See Linux support for Broadcom 4331 wireless chip (Macbook Pro 8,1) for a great how-to.
  • Get on a Long Term Support release.

In short, the experience was good, with two small snags.

Snag 1: Wireless

As expected, the upgrade left my patched wireless driver in the dust. This was relatively simple to fix. I just downloaded the Broadcom driver from the above-referenced how-to, ran the b43-fwcutter command (with the vanilla apt-get version–no need to patch or hand-build anything), and voila: wifi.

Snag 2: Xmonad

Xmonad was a little trickier. When I tried to run the “Gnome with Xmonad” session from the login screen, it failed. syslog showed a segfault, in Xorg I believe. Boo.

I removed and re-installed the xmonad and gnome-panel packages. One encouraging bit: the Xsession entries automatically showed up, which I believe I had to do by hand before. Nice. The Xsession stayed open, but the window manager seemed missing.

I tried moving my ~/.xmonad/ directory. That got Xmonad to stay alive, though it seemed confused about the gnome desktop, and keyboard shortcuts weren’t working.

So, I moved my ~/.xmonad/ directory back. The window manager seemed missing again. ps showed the Xmonad process was defunct, and something more insightful: it was running ~/.xmonad/xmonad-x86_64-linux. I whacked this file, logged back in, and all is well. Must’ve been a stale version compiled against old libraries.

Update
I just found this issue in an Xmonad bug report. Hopefully this will be automated in the post-install script soon.

Conclusion

Ubuntu 12.04 Precise Pangolin: so far, so good. I’m glad to have my wireless adapter better integrated into the kernel, and glad to be on an LTS release.

Filed Under: Tech Tagged With: 4331, macbook, ubuntu, upgrade, xmonad

Email Update: Notmuch

May 27, 2012 by Leave a Comment

Introduction

In my last email-related post, I discussed Disciplined Email via Gnus. I theorized that reading email like a newsgroup would enforce more disciplined, efficient email use. I stand by that philosophy, but changed my email client to Notmuch.

Why Switch from Gnus to Notmuch

Reasons for switching from Gnus to Notmuch include:

Local copy of email
I had been doing email over IMAP, both work and personal. I was interested in getting a local copy of my email for backup and availability purposes. For this, I use OfflineImap, which synchronizes IMAP email with a local maildir. This integrates nicely with Notmuch, while I found Gnus maildir support slow and clunky.
Fast search
Search lives at the core of Notmuch. As a response to the Sup email client (get it?), Notmuch provides indexing, and searching, while search seems peripheral to Gnus.
Unified email
I like the unified inbox I get with K9 mail on my Android phone. I find separation between email accounts unnatural. Notmuch provides a single “inbox” tag for new messages, regardless of the account; I did not figure out how to do this easily in Gnus.

Nits About this Setup

A couple smaller things bug me about my current setup, though possibly not enough for me to spend time fixing:

OfflineImap occasionally goes to lunch
I think this happens when OfflineImap is running when I put my laptop to sleep. When it wakes up again OfflineImap eats a CPU, so I go kill it. I run OfflineImap via cron, so I don’t need to restart anything.
Email forwards sent from default account
When responding to email via the Notmuch emacs mail client (which uses Message Mode) does the right thing–if you have multiple email accounts, it sends the response from the account that received the email. However, email forwards send from the default account, even if a different account received the original email.

Conclusion

I find email with Notmuch + OfflineImap superior to Gnus + IMAP.

Filed Under: Tech Tagged With: emacs, email, gnus, notmuch

  • Page 1
  • Page 2
  • Page 3
  • Go to Next Page »

Primary Sidebar

Recent Posts

  • Recover from Blank Screen After Unplugging External Display in XFCE
  • Remove a Key Binding From Emacs Mode
  • Disable Bluetooth on Ubuntu Startup
  • Geequie: Cull Photos on Linux
  • Sync PDFs with Android using Dropsync

Recent Comments

  • Ricardo Orbegozo on Linking to MS Office File in Emacs Org Mode
  • eliaso on Linking to MS Office File in Emacs Org Mode
  • Joao Brito on Linking to MS Office File in Emacs Org Mode
  • Unable to install Emacs 24 from ppa:cassou/emacs | Ubuntu InfoUbuntu Info on Install Emacs 24 in Ubuntu
  • Unable to install Emacs 24 from ppa:cassou/emacs | WyldePlayground.netWyldePlayground.net - on Install Emacs 24 in Ubuntu

Copyright © 2025 · Mikey Boldt Theme on Genesis Framework · WordPress · Log in