Summit 2010 Lab

June 4th, 2010

Only just over 2 weeks left until Red Hat Summit 2010. Be sure to check out my lab on Wednesday afternoon:

Cloud Computing with Red Hat Enterprise Linux on Amazon EC2
Cloud computing is fast becoming a core component of both Web and enterprise IT infrastructure architectures. With Red Hat Enterprise Linux on Amazon EC2, you are able to experience both the dynamic scalability of the Amazon EC2 cloud combined with the enterprise stability and security of Red Hat Enterprise Linux.

Presented by Red Hat and sponsored by Amazon Web Services, this lab tutorial will walk participants through a complete lifecycle process of setting up Red Hat Enterprise Linux on Amazon EC2, accessing running images, and terminating those instances using both Red Hat and Amazon tools.

Guaranteed to be 100% awesome.

Happy Fedora 13 Day!

May 25th, 2010

Congrats to everyone involved.

http://fedoraproject.org/

I don’t know why this caused me so many problems, but I finally got my look and feel for emacs to a happy state. The default emacs font size is just too big for my tastes. I tried using the menu bar “Customize Emacs” option to change the font, but that caused emacs to flicker for a few seconds each time I opened it. Being the kind of person who navigates around a shell and opens files from there (as compared to using a single emacs instance to load multiple files and switch buffers), the flicker was driving me nuts.

The menu bar customization added all of the following flicker-inducing configuration to .emacs:

(custom-set-faces
  '(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil 
:overline nil :underline nil :slant normal :weight normal :height 98 :width normal
:foundry "unknown" :family "DejaVu Sans Mono")))))

I was able to replace that with the simpler, flicker-free:

(set-face-attribute 'default nil :height 92)

The other thing I wanted was a larger emacs window by default (yes, I’m that lazy that manually resizing them was driving me nuts):

(if (window-system) (set-frame-height (selected-frame) 66))
(if (window-system) (set-frame-width (selected-frame) 102))

That gives me a workable font and a window size that lets me comfortably fill my screen with two emacs windows working side by side. Now I just need to actually focus and get to work to take advantage of my new found editor goodness.

I’ve used two monitors for years now on a kinda cheap card with one DVI and one VGA port. Naturally, I use the DVI one as the primary monitor, keeping the VGA as a supplement for extra space. However, my card detects the VGA as the “primary” monitor and puts my Gnome panels on that monitor. I learned to live with it, almost enjoying the fact that my primary workspace had no decorations at all.

However, I got curious and dug into it to find the setting to change this:

gconftool-2 -s /apps/panel/toplevels/top_panel/monitor --type int 1

Alternatively, use gconf-editor to navigate to that location and change monitor from 0 to 1 from there. I didn’t even need to re-login, it just hopped across to the other monitor.

UPDATE: Ya, so apparently you can just alt + left click to move the panel between monitors. The interwebs is awesome, thanks to mbooth in the comments for that one.

Screen

January 19th, 2010

I love when I find useful built-in commands that I never knew about. When starting out with Linux, I heard about the typical heavy hitters like grep, sed, and awk. Then I discovered some variations on common commands, such as htop and less. And then every so often, someone mentions a command in passing that causes me to say “Wait… what is that?”

Screen is one of those sorts of tools. I was watching a VNC demo of one of our team’s sprint reviews and was distracted by the fact that he had a tab bar on the bottom of a terminal. It turns out that was just part of the coolness of “screen”.

Screen is basically a window manager that runs in a terminal, letting multiple shells run within the single terminal. I’m sure there are other features that I’d find awesome, but there are two that immediately stood out.

As I mentioned, screen allows you to run multiple shells inside of a single terminal. Instead of starting up a handful of separate SSH sessions to a server, I now just use screen to manage multiple shells inside of a single connection. Each call to screen creates a new shell, with a simple emacs-like syntax to switch between them:

ctrl + a + n    #  next
ctrl + a + p    #  previous
ctrl + a + 0    #  select screen 0

One side note on this, by default the tab bar displaying the running shells isn’t displayed. Adding the following to ~/.screenrc enables a visual indicator of the current and possible shells that are open:

hardstatus on
hardstatus alwayslastline "%{-b gk}%-w%{+b kg}%50>%n %t%{-b gk}%+w%< %= %{w}%D %M %d %C%a"

While useful, it can still get a little confusing when a bunch of shells are opened. The title can be set by:

ctrl + a  A

The second major piece of awesomeness is the ability to detach from a running screen and reattach later. Going back to the SSH example, this lets me leave some shells running, detach, completely disconnect from the server, and then reattach to the screen later (with everything left exactly as it was).

Again, an emacs-like syntax for detaching from a running screen:

ctrl + a + d

Later, to reattach to the running screen detached from earlier:

screen -dr

Like I said, I’m not trying to make this post sound like I’ve discovered some hidden black magic in Linux. It’s just an attempt to let new users know about this awesomeness.

Removing desktop icons in Gnome

December 11th, 2009

A friend of mine is migrating from Windows to Fedora and has been asking me a bunch of questions about my setup. As I was looking over my wiki for notes I’ve taken, I realized one of the tasks I always find myself doing in Gnome is to disable the default desktop icons. My reasoning is a combination of the fact that I try to use the mouse as little as possible and a compulsive desire to have an empty desktop. I should probably seek some psychiatric help on the compulsion, but since I was able to disable the icons the doctor will have to wait until my next episode.

There is unfortunately no menu option for this in preferences, so I had to use gconf-editor. That’s not installed by default, but it’s easy enough to fix that.

sudo yum -y install gconf-editor

Once it’s installed, run it and navigate to apps -> nautilus -> desktop. Uncheck the *_icon_visible options until your compulsion subsides and you’re good to go.

Devil’s Pie

December 9th, 2009

I’ve been using Gnome for almost a year and a half now, and while I have grown to love a lot of the advantages it has, there are still some things I miss about FVWM. From a keyboard shortcut standpoint, many of them were alleviated when I discovered Gnome Do. However, I still found myself missing sticky, transparent shells that would give me a constant view into certain data, be it htop or tailing some files. It was really quick to set up in FVWM, but I had trouble finding a way to remove window decorations from windows in Gnome.

Devil's Pie + Gnome Terminal = WinClick for 1680×1050 version

Sure, there are other ways to get the data I’m looking for, but having text rendered directly on the desktop like that just looks damn cool to me. It also intimidates the crap out of non-geeks when they see my office, which I fully admit is a big plus.

I came across a package called Devil’s Pie that gave me a lot more control over windows. Although I was looking for something that would let me actively select a window to give it certain properties (sticky, no decorations, etc), Devil’s Pie instead passively detects new windows and applies settings to them. It’s a mentality shift from my initial thoughts, but I think over time this model will actually be really useful. Plus, it has “pie” in the name, which is just awesome.

With a combination of gnome-terminal profiles/flags and Devil’s Pie configuration, I was able to get my desktop to automatically populate my desktop with all sorts of data. The following description of how is kinda wordy, but it’s really not complicated at all.

Install and Configure Devil’s Pie

sudo yum -y install devilspie
mkdir ~/.devilspie
touch ~/.devilspie/console.ds

Devil’s Pie reads all configuration files (I believe they have to end in .ds, but don’t quote me on that) in the above directory on startup. Those files define the rules that will be applied to new windows that are created (there’s also a way to ask it to apply rules to all existing windows as well). For this example, I put my rules in a file named console.ds.

(if 
(contains (window_name) "console" )
(begin 
(undecorate)
(pin)
(skip_pager)
(skip_tasklist)
)
)

There are two main parts to the above configuration. The first is the matching expression to decide if a window should have the rules applied. In this case, I indicate to apply the actions if the window name contains the string “console” (there are also options for “is” and “matches”). I’ll cover where that rule comes into play in a bit.

The actions do the following:

  • undecorate – This is primarily what I was going for, I want the window decorations removed. This includes the title bar and border, though you can still use the shortcut key (alt+F8 by default) to resize a window without decorations.
  • pin – Make this window available on all workspaces. There are also attributes to control putting a window on a particular workspace, which could be useful in my case since I use 12 workspaces and am, well, pretty anal retentive about having certain applications in certain workspaces.
  • skip_pager – Don’t let the window show up in the pager. It removes the clutter in my pager since I don’t consider this a “real” application, just a status-type window.
  • skip_tasklist – A little more useful than skip_pager, this keeps the window off the taskbar, for the same rationale as above.

Needless to say, I’m only scratching the surface of all of the actions supported. I haven’t found a good way to find this list yet; the man page says the -l flag will list symbols but when I try it, it just doesn’t do anything.

Run Devil’s Pie

devilspie

Not much to say about that. I’ll talk more about enabling a debug mode later, but I mention it now to say it’s not done through flags. You’ll need to restart it every time you change your confguration files, but once you’re set add it to System -> Preferences -> Startup Applications and you’re good to go on reboots.

Create Gnome Terminal Profile

To summarize above, Devil’s Pie will take care of removing window decorations and keeping it on the visible workspace. We still need to configure Gnome terminal to add some slickness to how it looks. Since I don’t want this slickness on all of my terminals, I created a new profile named “console” with the following changes:

  • Background – Transparent background, with the slider set all the way to none.
  • Scrolling – Scrollbar is: Disabled

That gives us a completely transparent shell, reflective of its use to simply throw data at me.

Start the Terminal

Now we just need to make sure we start the terminal such that it will use the right profile and will trigger the window detection from Devil’s Pie. Here’s where the matching expression from above comes into play. I don’t want all of my terminals to have no decorations, just specific ones I want to treat in this fashion. When starting the terminal, tell it to use a specific window title that will match our Devil’s Pie rule from above.

gnome-terminal -t console --profile=console --geometry=140x20+1680-0 -e htop

A quick explanation of above:

  • -t – Sets the title of the terminal window. This value should match up to the window_name value from the Devil’s Pie configuration.
  • –profile – Tells the terminal to use the slick console profile in all of its transparent goodness.
  • –geometry – Initially size and place the terminal on my screen.
  • -e – Run a specific command when it starts, in this case htop.

My screenshot above simply uses a similar call to gnome-terminal, passing a tail command to -e and different geometry to get the log tail on the top of the screen.

Two other notes on Devil’s Pie:

There is a UI for editing the configuration files: gdevilspie. It’s handy because you can easily see the different types of matching expressions and actions, however the files it generated didn’t run for me. For some reason, even with one matching expression it still added a blank condition and an “and” statement and closed the conditions block too early. I haven’t looked to closely yet to see what is wrong.

Enabling debugging is as simple as adding another configuration file. I added one named “debug.ds” to my ~/.devilspie directory that contained simply:

(debug)

Once that is in place, running the devilspie executable from the command line output some really useful window information whenever a new window was created.