A site about Linux, coding in general, and things I've figured out. Add the occasional rant, musings on the world, and visions of the future. Stir, and sip lightly.
Random header image... Refresh for more!

OSX Style Monitor Switching On Ubuntu

I recently decided it was complete bullshit that you can’t just plug in an external monitor and switch to it easily in Ubuntu. In OSX you’ve been able to do this for years. You just plug in your external monitor and it automatically switches to the last known good configuration for that monitor.

Anyway, with a little searching I discovered that there are some tools that you can use to get very close to this behavior on Ubuntu. I’ve been using two tools, disper and auto-disper for a few months now and they are fantastic.

Firstly, disper will let you switch to an external monitor effortlessly from the command line. Whether it’s ever seen that monitor or not, it will choose the sensible default resolution and just make it so. To wit: disper -S to switch to external, disper -s to switch back to internal (the difference is the case of the ‘s’). This tool can do much more, but that’s my 99% use case.

Then you add auto-disper --save <profile-name> to the mix. This will let you store a profile for the current configuration of the monitors that are present. Then when you call it with auto-disper --change, it detects the present set of monitors and switches to the profile that matches them.

Depending on your graphics driver, you may or may not be able to go a step further and automatically call auto-disper --change when a new monitor is plugged in. My NVIDIA drivers won’t do that, unfortunately. If they could then it would be almost equal to the OSX functionality. As it is, it’s quite close enough, and I am happy.

I did a full writeup on how to do all of this on the Ubuntu wiki. See DynamicMultiMonitor.

December 9, 2011   No Comments

Skype Extension for Chrome

I’m working on a Chrome extension that will link phone numbers within pages so you can call them with Skype. It’s rough, but check it out if you’re interested:

https://github.com/jacksenechal/Skype-for-Chrome

In particular, I haven’t figured out how to make the external URL handler that Chrome uses on Linux (xdg-open) recognize the `callto:` link format. This plugin may just work for y’all out there on Windows or OS X though, I don’t know. I’ll post an update when I have more.

February 17, 2011   No Comments

Android video encoder

I wasn’t having much luck finding an easy way to encode videos for viewing on my phone, so I cooked one up. I followed the instructions for ffmpeg as listed here, and wrote a Ruby wrapper that detects the dimensions of the video and scales them down to the right size for you phone.

The script is simple so it can be easily edited to include your preference of encoding switches to ffmpeg. It’s using the h264 codec, which is a bit slower to encode but makes beautifully smooth high quality videos and a fraction of the size of quicker methods.

Grab the script at Github: https://gist.github.com/823686

February 12, 2011   No Comments

Getting started with OSMF & Flex 4 on the Linux Command Line

If you’re using Flex on the command line without Flex Builder, the documentation for getting up and running with OSMF is pretty slim. Here’s what has worked for me. (I upgraded to Flex 4 to get access to all of the OSMF features, but you should be able to do this with Flex 3 as well).

First, get the latest OSMF from the downloads page: http://sourceforge.net/adobe/osmf/home/. There’s an older version packaged with Flex 4, but OSMF is evolving very quickly so get the most recent.

Unzip that basically anywhere. It doesn’t fit neatly into the Flex directory structure, and if you try to replace the old OSMF files in the Flex package you’ll have problems building the asdocs, so just pop the new OSMF in the Flex home directory or something.

Now to get Flex to use it you have to tell the compiler where to find it, and add a few tweaks. Here’s my mxmlc command:

mxmlc \
	-compiler.source-path=/path_to_new_osmf/framework/OSMF/ \
	-define CONFIG::LOGGING false \
	-define CONFIG::DEBUG true \
	-define CONFIG::FLASH_10_1 false \
	-compiler.debug=true \
	-static-link-runtime-shared-libraries \
	YourFlexApp.mxml

That should get you running! Check out these resources for some basic examples. Keep in mind that since OSMF is changing so quickly, you may have to look around for where this or that package is hiding today…

OSMF + Flex Example [brooksandrus.com]

New Intro to Adobe OSMF Videos [almerblank.com]

[Read more →]

December 18, 2010   No Comments

Batch CD and DVD ripping/burning

I was faced with the task of ripping a few box sets of DVDs and CDs today, and after a quick and fruitless “topeka” search for a way to automate this, I wantonly decided to write my own.

A short time later I had a nice Ruby script capable of ripping discs to images without any user input, except sticking in the next disc after one is ejected. It can also reverse the process and take sequentially named image files and burn them with the same ease.

I’d been wanting to try out this great Ruby gem “commander” for a while. It was a breeze to get a full-blown command-line interface up and running with this thing. Truly amazing, Ruby style. Following some very sage advice I have recently forsworn bash programming in favor of more friendly modern scripting languages, and I must say… I’m definitely not going back!

I was quite pleased with the way it turned out, so I thought I ought to share. This is another first for me today: it’s the first open source project I’ve released! Well, almost. I wrote a 4D fractal generator back in university, and it’s probably still lurking around on SourceForge somewhere… with a grand total of 240 downloads after 1964 days of inactivity :-P . It was pretty alpha-state software, so I’d be surprised if it got much use. I honestly still think about going back and improving it one of these days, when I have time. Haha… time. We’ll see eh?

Anyhow, I’ve called this script “Jack’s TehRipper”, and you can find it on Github at http://github.com/jacksenechal/TehRipper. I released it under the MIT license, so grab a copy, fork it to your heart’s content, whatever.

Using it is quite easy. Running tehripper by itself gives you a list of the available commands:

  NAME:

    tehripper

  DESCRIPTION:

    A program to batch read/write raw CD audio or CD/DVD data for backup

  COMMANDS:

    help                 Display global or [command] help documentation.
    read-audio           Reads audio data from CD to new local directory, eg. "./cd1/"
    read-iso             Reads DVD image to working directory, eg. "./dvd1.iso"
    write-audio          Writes audio data to CD from local directory, eg. "./cd1/"
    write-iso            Writes DVD image from working directory, eg. "./dvd1.iso"

The commands also take some arguments, for instance:

  OPTIONS:

    --start n
        The starting number for image file naming (defaults to 1)

    --end n
        The ending number for image file naming (defaults to 1)

    --prefix string
        The prefix for the image file name (defaults to "dvd")

So to copy a disc image in ISO format to your local working directory from a DVD in your drive, you would just say:

tehripper read-iso

Or to make ISOs of your uber-favorite i luv u 4evar 10-DVD set, you would issue a command like:

tehripper read-iso --start 1 --end 10 --prefix The_Princess_Bride_Collectors_Edition_Box_Set

How much cooler could that get?

August 29, 2010   No Comments