Setting an external monitor as default on the Ubuntu login screen

In /etc/lightdm/lightdm.conf, add these lines to the SeatDefaults section:

display-setup-script=xrandr --output VGA1 --mode 1280x720 --primary
session-setup-script=xrandr --output VGA1 --mode 1280x720 --primary

If the external monitor is not detected, this may cause an error:

The system is running in low-graphics mode

Back up a git repository in a single file

This page contains a comparison between different approaches and file formats for backing up a git repository in a single file.

Summary: The best method is probably git bundle

R quick reference cheat sheet

Here are some notes I took while learning about R:


  • ?matrix -- gets help on "matrix"
  • ls() -- lists variables that exist
  • rm() -- deallocates a variable

Run script from command line

Rscript hello.r


    typeof(x) returns the type of x

    Memory usage in Haskell is difficult to predict

    Laziness [in Haskell] makes it much, much harder to reason about performance, especially space.

    Consider a very long list of 'a's called long which we play with in GHC 7.6.3:

    largenum = 10000000
    as = repeat 'a'
    long = take largenum as

    Light Painting With Drones

    8 things to learn in school if you want to go into computer game programming

    A young relative of mine might be interested in computer game programming. I'm not in the game industry, but I drafted a list of things that I thought he might focus on in school.

    Wisdom of the herd

    The hammer principle lets you crowdsource your opinion about gin, martial arts, version control systems, web browsers, databases and programming languages.

    Turning an external monitor on by default in Ubuntu

    To use a specific resolution, or turn on or off certain displays by default when you log in, you can create an .xprofile file in your home directory which runs xrandr commands.  For example, this .xprofile will turn on an external VGA monitor and set it to 1280x720 resolution and then turn off the internal LCD monitor on a laptop.

    xrandr --output VGA1 --mode 1280x720
    xrandr --output LVDS1 --off

    Dropping partial InnoDB tables left from a crash

    It's possible for MySQL to orphan temporary, partial InnoDB tables if the MySQL server crashes during an ALTER TABLE operation.

    When this happened to me, I would get cryptic error messages when trying to create or drop certain tables, or create certain foreign key constraints, like:

    ERROR 1005 (HY000) at line [. . .]: Can't create table 'my_database.#sql-509_5a' (errno: 121)

    Using a VPN in Ubuntu Linux when your network is controlled by ifupdown

    According to this bug and this bug, it's not possible to use a VPN through NetworkManager (the GUI for managing networking in Ubuntu) if your wireless or ethernet networking is configured using ifupdown aka /etc/network/interfaces. An example of this situation is if you're using NFS shared folders in Vagrant.


    Subscribe to RSS - Tech