install-gitweb-to-a-subdirectory

Reach gitweb at a subdirectory, i.e. “http://moosechips.com/gitweb”. The gitweb README and INSTALL files come with instructions on setting up access to your root web directory, but chances are you’re already using that for your homepage. Here’s the setup for installing to a subdirectory. (This worked for me with git-1.7.0.1)
Read the rest of this entry »

Thanks to Mozilla for providing excellent linux font DPI support.

On my Gentoo setup, I added a Xft.dpi setting go my ~/.Xdefaults file. Now my fonts look normal again. :)

Xft.dpi: 108

Before:

screenshot-fonts-before

After:

screenshot-fonts-after

x-and-hal-on-gentoo

Instructions for installing xorg-server and hal on gentoo.

I’m writing this because the gentoo documentation for X setup is very outdated. Gentoo now uses xorg 1.5 which uses hal to setup devices automatically instead of having to configure /etc/X11/xorg.conf. The Xorg 1.5 update guide might be a little helpful, but it’s missing some info and is a bit vague in places.

Xorg-server 1.5 setup

Make sure your kernel is compiled with Event interface support. (If not, see Gentoo Handbook: Configuring the kernel for help recompiling your kernel)

Device Drivers --->
 
Input device support --->
 
--- Input device support
[*]     Event interface

Add X and hal USE flags (the “–alpha-order” is optional, but I like to keep my USE flags organized)

flagedit --alpha-order +hal +X

(or equivalently with euse. euse is from the app-portage/gentoolkit package)

euse -E hal X

Add to /etc/make.conf

INPUT_DEVICES="evdev"
# Change the video driver to match your video card
# or install a bunch and let hal choose
VIDEO_DRIVER="nv nvidia radeon radeonhd intel sis via vesa fbdev"

Install xorg-server (which will also install hal since the hal USE flag is now enabled)

emerge -av xorg-server

Add hal policy files so hal can auto-detect your devices. Doesn’t hurt to add them all, hal will figure out what it needs.

cp /usr/share/hal/fdi/policy/10osvendor/* /etc/hal/fdi/policy

Add hald to startup and start hald

rc-config add hald default
/etc/init.d/hald start

Don’t need any /etc/X11/xorg.conf file

mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak

Now startx

startx
intel-4965-wireless-on-gentoo

I recently configured the wireless on my X61 Tablet for Gentoo. I have a Intel 4965 AGN wireless card.

lspci | grep -i wireless
03:00.0 Network Controller: Intel Corporation PRO/Wireless 4965 AG or AGN Network Connection (rev 61)

Relevant kernel options (from gentoo-sources 2.6.28-r5 kernel)

Device Drivers  --->
  [*] Network device support  --->
    Wireless LAN  --->
      {*} Intel Wireless Wifi Core
      <M> Intel Wireless WiFi Next Gen AGN
        [*]   Intel Wireless WiFi 4965AGN

Install wpa_supplicant and wireless-tools

emerge -av wpa_supplicant wireless-tools

Create symlink so Gentoo will initialize the wlan0 at startup

cd /etc/init.d
ln -s net.lo net.wlan0

/etc/conf.d/net

modules=( "wpa_supplicant" )
iwconfig_wlan0="mode managed"
wpa_supplicant_wlan0="-Dwext"

/etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
 
network={
  ssid="MySSID"
  scan_ssid=1
  key_mgmt=WPA-PSK
  psk="password"
  priority=5
}

I was getting SCICSIFFLAG File Not Found errors when trying to bring up my wlan0 interface. A look at the dmesg log revealed that the iwlagn module was trying to access iwlwifi-4965-2.ucode, so I emerged iwl4965-ucode to fix that.

emerge -av iwl4965-ucode

Reinitialize the interface to see if everything worked

/etc/init.d/net.wlan0 restart
bootable-gparted-usb-stick

Creating a bootable usb stick with the Gparted live iso in Ubuntu. Gparted is a graphical partition editor which can resize, move, copy, create, delete your hard drive partitions.

Overview:

  • Format your usb stick to Fat16 and make it bootable using gparted.
  • Install the gparted-live*.iso using unetbootin. (unetbootin also automatically installs the syslinux bootloader)
  • Reinstall syslinux onto usb stick. (Gparted’s live cd requires syslinux newer than ver 3.71. Currently (May 7 2009) Ubuntu 9.04 Jaunty has syslinux 3.63. Use apt-cache show syslinux | grep "^Filename" to check Ubuntu’s version)

Installation Steps

1. Install gparted and unetbootin

sudo aptitude install gparted unetbootin

2. Download the gparted live iso and the latest syslinux.

wget http://superb-west.dl.sourceforge.net/sourceforge/gparted/gparted-live-0.4.4-1.iso
wget http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.80.tar.bz2

3. Insert your usb stick into the computer, and copy any files you want to save to your hard drive. You will be reformatting your stick and will lose all the files on the usb drive.

4. Run gparted.

sudo gparted

Select your usb drive. (Probably something like /dev/sdc). Right click on the partition and select Unmount to unmount the drive. Format the drive to Fat16 and apply. Then make the usb drive bootable by going to Manage Flags and selecting the boot flag.

screenshot-gparted

Exit gparted.

5. Remount your usb drive by unplugging and replugging your usb stick.

6. Run unetbootin

unetbootin

Select Diskimage ISO and locate the gparted-*.iso that you downloaded. Make sure the correct partition is selected at the bottom and click OK.

screenshot-unetbootin

Don’t reboot yet. Just exit unetbootin.

7. Now, you would be done, except that Ubuntu’s syslinux is version 3.63 and the gparted live iso requires at least syslinux version 3.71, so you need to reinstall syslinux onto your usb stick.

Unpack the syslinux tarball you downloaded.

tar xjvf syslinux-3.80.tar.bz2

Now install syslinux onto your usb stick

cd syslinux-3.80/linux
sudo ./syslinux -s /dev/sdc1

8. Now you’re done. Reboot using your new gparted bootable usb stick.

End Notes:

This method should work on other bootable isos too.

You could try to use Fat32 if your motherboard supports booting from Fat32 USB devices. Fat16 is generally more compatible though.

If your USB stick is bigger than the the allowable Fat16 size (2gb), make two partitions: first a 1-2gb Fat16 partition for your boot drive, and a second Fat32 partition with the rest of the space.

grep-and-less-with-color

Add these lines to your ~/.bashrc to make colorful grep | less output.

alias grep='grep --color=always'
export LESS='-R'
emacs-experimentation

My experiences as a [g]vim user trying out emacs.

Day 1:

Emacs commands

Running emacs was no problem, as it was already installed from Fedora’s repository. Reading through some emacs tutorials, I found Emacs For VI Users very helpful.  Probably my most used  vi commands are delete line (dd), yank line (yy), and put (p or P).  Emacs  confusingly uses “yank”  to describe the  vi equivalent “put” command of inserting saved text into the document.  Getting used to the sequences of ctrl / alt + key is strange when I’m used to the efficient vi commands.  ”yy” becomes “Ctrl+a  Ctrl+k Ctrl+k Ctrl+/”.

Tab behavior

Started trying to edit some c++ files using emacs, but found that the default tabbing behavior was messing up my indentation.  The default emacs uses 2 spaces per indentation, and will use the tab key to automatically indent code instead of inserting a tab character.  I like to tab-indent my code and view it as 4 spaces / tab.  This was frustratingly difficult to solve, as emacs has so many options, and many of the emacs options have cryptic names and unclear descriptions.  I finally found some sane lines to put into my ~/.emacs file from Emacs Tips N Tricks For Everybody.  The

(global-set-key "\C-m" 'newline-and-indent)

line is really nice to emulate vi’s autoindent feature. Understanding GNU Emacs and Tabs is also useful for understanding emacs’s special tabbing behavior.

Day 2:

Antialiased fonts

Discovered that emacs 23 supports antialiased fonts, but there’s no stable release yet, and no Fedora 8 rpm.  So, I downloaded the source from cvs and built.  Now running

emacs --font="monospace-10"

works, and emacs looks great.

Start in background

I wrote a bash wrapper to always start emacs in the background (similar to gvim) with the monospace font.

#!/bin/bash
# start emacs in the background with the monospace font
exec emacs-23.0.92.1 --font="monospace-10" "$@" &

My ~/.bashrc has an alias to run this wrapper. (I put the wrapper in ~/bin/emacs)

# .bashrc alias
alias emacs="~/bin/emacs"

Matlab files

Opening a matlab .m file tries to use the ObjC mode. You can add the matlab mode to emacs using the matlab.el file from matlab-emacs. I put the file at ~/.emacs_addons/matlab.el and added these lines to my ~/.emacs file:

; Add addons dir to path
(setq load-path
      (append (list nil "~/.emacs_addons")
              load-path))
; Add matlab.el module
(autoload 'matlab-mode "matlab" "Enter MATLAB mode." t)
(setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist))
(autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t)

Regular expressions

Emacs offers search and replace with regular expressions using the Ctrl-Alt-% command, with some caveats

Tab bar

Opening multiple files in emacs puts each file into a buffer, but there is no [g]vim/firefox-like tab bar which shows the open files. You have to go through the list of buffers or split your window. But at least there is the TabBar mode addon.

linux-find-motherboard-information

Find the manufacturer and version of your motherboard with this command:

sudo dmidecode | grep "Base Board" -A 13

Example output:

Base Board Information
        Manufacturer: ASUSTeK Computer INC.
        Product Name: Maximus Formula
        Version: Rev 1.xx
        Serial Number: XXXXXXXXXXX
        Asset Tag: To Be Filled By O.E.M.
        Features:
                Board is a hosting board
                Board is replaceable
        Location In Chassis: To Be Filled By O.E.M.
        Chassis Handle: 0x0003
        Type: Motherboard
        Contained Object Handles: 0
fedora-rebuild-a-source-package

General instructions to rebuild a Fedora source rpm.

Note: This example uses the vlc source rpm, but it doesn’t work on my Fedora 8 system because there are problems installing dependencies, but the general commands should work on other packages

  1. Install build tools
    su -c 'yum install yum-utils rpmdevtools'
  2. Download source package. Either use yumdownloader to download from an existing repository:
    yumdownloader --source vlc

    or download directly from a server

    wget -nd ftp://ftp.pbone.net/mirror/rpm.livna.org/fedora/development/SRPMS/\
    vlc-0.9.0-0.5.20080802git.lvn10.src.rpm
  3. Install the source package. This will unpack the source into your /$HOME/rpmbuild directory.
    rpm -Uvh vlc-0.8.6i-1.lvn8.src.rpm
  4. Install build dependencies for the source package
    su -c 'yum-builddep vlc-0.8.6i-1.lvn8.src.rpm'
  5. Edit the spec file
    cd ~/rpmbuild/SPECS
    vim vlc.spec
  6. Add the new source package
    cd ../SOURCES
    wget -nd http://download.videolan.org/pub/videolan/vlc/0.9.2/vlc-0.9.2.tar.bz2
  7. Build the rpm
    cd ../SPECS
    rpmbuild -bb vlc.spec
  8. Install the rpm
    cd ../RPMS/x86_64
    rpm -Uvh vlc-0.9.2.fc8.x86_64.rpm

References:
Building a kernel from the src rpm
Fedora rpm guide

google-chrome-on-linux-via-wine

So it’s possible to run the Google Chrome browser using Wine (latest dev version 1.1.4), though it’s kinda slow, and won’t do any https sites.

Ubuntu thread w/ instructions (These didn’t work for me on Fedora 8)

Wine App DB page w/instructions (These worked for me on Fedora 8)

ubuntu-wacom-tablet-hotplugging

Update 11-04-2008: The release version of Ubuntu 8.10 Intrepid should work out of the box, so you don’t need to do any of this. However, only the stylus works. If linuxwacom comes out with an update to use the eraser and tablet buttons, you might need to manually install the linuxwacom driver, but right now, enjoy the “it just works” philosophy. :)

Ubuntu 8.10 “Intrepid Ibis” will use Xorg 7.4’s input hotplugging, allowing auto-detection of input devices (e.g. keyboards, mice, tablets) during an X session. (Previously, input devices were only detected at the startup of an X session.)

Note that there are still a number of bugs with hotplugging:

  • you must install the latest linuxwacom driver to get correct clicking
  • hotplugging will only recognize the stylus events (so no eraser or express buttons)
  • unplugging the tablet causes X to crash. Edit 9-20-08: There is a line in the linuxwacom source you need to edit to fix this (see step 4 of Manual Installation below). [linuxwacom post] Edit 11-04-08: Intrepid updated the linuxwacom driver that ships with Intrepid, so you don’t need to install the updated linuxwacom driver.

Installing LinuxWacom driver in Intrepid
(based off the Hardy linuxwacom install thread, here. Tested on Intrepid alpha 6 LiveCD)

Easy Method:

  1. Download my install_linuxwacom script
  2. Run the script
    chmod +x install_linuxwacom
    ./install_linuxwacom
  3. Enjoy!

Manual Installation Steps:

  1. Install required packages
    sudo apt-get update
    sudo apt-get install linux-headers-$(uname -r) build-essential x11proto-core-dev libxau-dev libxdmcp-dev x11proto-input-dev x11proto-kb-dev xtrans-dev libx11-dev x11proto-xext-dev libxext-dev libxi-dev linux-libc-dev libc6-dev libncurses5-dev xserver-xorg-dev tk-dev tcl-dev -y
  2. Download latest linuxwacom-dev package from linuxwacom (0.8.1-4 as of this writing)
    wget -nd http://prdownloads.sourceforge.net/linuxwacom/
    linuxwacom-0.8.1-4.tar.bz2
  3. Extract the source
    tar xjvf linuxwacom-0.8.1-4.tar.bz2
    cd linuxwacom-0.8.1-4
  4. To fix the X crashing when unplugging the tablet, edit line 381 of src/xdrv/wcmConfig.c replacing WCM_UNINIT_CALLED with WCM_XORG_XSERVER_1_4
    sed -i -e '381s/WCM_UNINIT_CALLED/WCM_XORG_XSERVER_1_4/' src/xdrv/wcmConfig.c
  5. Compile the driver
    ./configure --enable-wacom
    make
    sudo make install
  6. (Optional) You can test the kernel module before installing it. Plug in your tablet and see if it works correctly after executing these commands.
    sudo rmmod wacom
    sudo insmod src/2.6.26/wacom.ko

    If it doesn’t work, you can reload the original driver. (Or just reboot your computer)

    sudo rmmod wacom
    sudo modprobe wacom
  7. Install the kernel module (and backup the original). (Note: The 2.6.26 module works with Intrepid’s 2.6.27 kernel)
    cp /lib/modules/$(uname -r)/kernel/drivers/input/tablet/wacom.ko wacom.ko.$(uname -r)
    sudo cp src/2.6.26/wacom.ko /lib/modules/$(uname -r)/kernel/drivers/input/tablet/wacom.ko
  8. Reload the kernel module with the new version
    sudo rmmod wacom
    sudo modprobe wacom
  9. Enjoy!

Read the rest of this entry »

ubuntu-rebuild-a-source-package

# install deb build tools

sudo apt-get install build-essential fakeroot dpkg-dev devscripts

# download the source code

apt-get source package

# install other packages needed to build

sudo apt-get build-dep package
cd package

# update the version in the changelog

dch -i

# make any changes to the source
# e.g. vim debian/rules

# then build the new package

dpkg-buildpackage -rfakeroot -uc -b

#install the package

cd ..
sudo dpkg -i package.deb