jamesoff.net




6
Mar
2008
0

vim as a man-page reader

Sure, why not :)

This goes in your zshrc:

  vman() {
    if [ $# -eq 0 ]; then
      /usr/bin/man
    else
      if man -w $* >/dev/null 2>/dev/null
      then
        /usr/bin/man $* | col -b | vim -c 'set ft=man nomod' -
      else
        echo No man page for $*
      fi
    fi
  }
  alias man='vman'

And this goes in your vimrc (in a suitable augroup):

  autocmd FileType man setlocal ro nonumber nolist fdm=indent fdn=2 sw=4 foldlevel=2 | nmap q :quit<CR>

Now you’ll get nicely highlighted man pages with folded sections, and you can hit q to quit just like less.

Vim as a manpage viewer


Permalink | Posted in FreeBSD Linux Sysadmin and tagged  



29
Oct
2007
1

Detecting memory type on FreeBSD

If you need to upgrade your RAM on a Windows machine, you can just use the Crucial Memory Advisor wotsit, which scans your computer using the power of, er, power to find out what your motherboard is, what RAM you already have, and then can tell you which overpriced Crucial RAM to buy.

On FreeBSD, this doesn’t work so well. However, you can tell manually tell the Crucial site what motherboard you have and it will tell you exactly what sort of RAM is best.

This is fine if you know what motherboard you have.

if you don’t, the answer is dmidecode(8) (/usr/ports/sysutils/dmidecode). This utility grabs the same information which the Crucial thingy does, so all you need to do is find the info you need.

(more…)





1
May
2007
2

Firefox Addressbar Select-on-click

In Windows, clicking on the addressbar in Firefox selects the existing URL so you can type to replace or paste to replace.

In FreeBSD, clicking on the addressbar doesn’t do that. However, when you manually select the URL so you can replace it, it overwrites the contents of your clipboard and makes it so much harder to paste the URL you were about to look at.

Luckily, you can fix this :) Browse to about:config and stick urlbar in the filter box. Find the browser.urlbar.clickSelectsAll setting and change it (by double-clicking) to true.

To paste, you’ll probably have best success with Ctrl-V as middlemouse seems to paste the clipboard without overwriting the previous contents.





2
Oct
2006
0

VMware Server’s httpd

After a brief powercut at work this morning the machine running VMware Server restarted. It came up fine, but wouldn’t start the VMware Apache server for the web interface. In /var/log/vmware-mui/error_log it was complaining:

[Mon Oct  2 08:37:46 2006] [error] ModVmdb load: Address of ModVmdb_InitCore: 0xb7c745a0\n
[Mon Oct  2 08:37:46 2006] [error] Failed to create named-pipe directory:
  /var/run/vmware//httpd/3854: No such file or directory\n
[Mon Oct  2 08:37:46 2006] [error] VMWARE PANIC: \nNOT_IMPLEMENTED F(4023):707\n
[Mon Oct  2 08:37:46 2006] [error] Panic: Could not allocate temporary context.\n

This is apparently a known problem on Ubuntu (which is what I’m running it on), and someone came up with this fix on the VMware community forums. However, I’m not entirely happy with setting a directory to 777 so instead I created the httpd directory and changed the owner to www-data, which is who the VMware Apache server runs as. That meant I could set the permissions to 700.

# mkdir /var/run/vmware/httpd
# chown www-data /var/run/vmware/httpd
# chmod 700 /var/run/vmware/httpd

Seems to be working fine now. I didn’t modify the startup script as suggested in the forum post yet, so I’ll see when I next restart this machine if I need to do that. (Possibly Ubuntu clears /var/run when it starts, which would explain it.)