Friday, September 22, 2006

vim command line history...

If you're on a Red Hat box (or some other lowly being...) and call vi and :ver tells you you're in vim, but when you try and get your command line history with Up-Arrow and it just says /<Up> .. have a look at :ver again and you will probably see:

~
~
~
~
~
~
~
:ver
VIM - Vi IMproved 6.3 (2004 June 7, compiled Feb 7 2005 08:07:43)
Included patches: 1-21, 23-24, 26, 28-34, 36-37, 39-40, 42-43, 45-46
Compiled by <bugzilla@redhat.com>
Tiny version without GUI. Features included (+) or not (-):
-arabic -autocmd -balloon_eval -browse +builtin_terms -byte_offset -cindent
-clientserver -clipboard -cmdline_compl -cmdline_hist -cmdline_info -comments
-cryptv -cscope -dialog -diff -digraphs -dnd -ebcdic -emacs_tags -eval
-ex_extra -extra_search -farsi -file_in_path -find_in_path -folding -footer
+fork() -gettext -hangul_input +iconv -insert_expand -jumplist -keymap -langmap
-libcall -linebreak -lispindent -listcmds -localmap -menu -mksession
-modify_fname -mouse -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm
-mouse_xterm +multi_byte -multi_lang -netbeans_intg -osfiletype -path_extra
-perl -printer -python -quickfix -rightleft -ruby -scrollbind -signs
-smartindent -sniff -statusline -sun_workshop -syntax -tag_binary
-tag_old_static -tag_any_white -tcl +terminfo -termresponse -textobjects -title
-toolbar -user_commands -vertsplit -virtualedit -visual -viminfo -vreplace
+wildignore -wildmenu -windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: i386-redhat-linux-gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pi
pe -march=i386 -mcpu=i686 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
Linking: i386-redhat-linux-gcc -L/usr/local/lib -o vim -ltermcap -lacl

If you read http://www.vim.org/htmldoc/cmdline.html#cmdline-history it says:

{not available when compiled without the |+cmdline_hist| feature}

The answer is to plant more trees.... (whoops, sorry Billy!)
Try "which vi" and if you're on Red Hat chances are you'll see:

user@host:~: which vi
/bin/vi
user@host:~: which vim
/usr/bin/vim
user@host:~: ll $(which vi) $(which vim)
-rwxr-xr-x 1 root root 473964 Feb 7 2005 /bin/vi
-rwxr-xr-x 1 root root 1966604 Feb 7 2005 /usr/bin/vim

do

alias vi='/usr/bin/vim'

And all your L337N355 will come flooding back to you!

Thursday, September 21, 2006

What's the IP of $HOSTNAME


perl -MSocket -e 'print inet_ntoa((gethostbyname '$HOSTNAME')[4]), $/;'

Dumping a webpage in text...

$ lwp-request -o text http://www.aotea.org/john/

This will probably need a few CPAN modules added to work, but the layout is nice and clean - it doesn't line up table cells.

$ elinks -no-numbering -no-references -dump http://www.aotea.org/john/

hostname in localhost line in /etc/hosts

DON'T DO IT!

the /etc/hosts file in the Slackware installer image still has this in it:


# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server. Just add the names, addresses
# and any aliases to this file...
#
# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name of the machine. It causes problems
# for some (stupid) programs, irc and reputedly talk. :^)
#

# For loopbacking.
127.0.0.1 localhost
# This next entry is technically wrong, but good enough to get TCP/IP apps
# to quit complaining that they can't verify the hostname on a loopback-only
# Linux box.
127.0.0.1 slackware.example.net slackware

# End of hosts.


Brain-dead Red Hat does this when you install


127.0.0.1 hostname localhost.localdomain localhost


Eeagh! WRONG!

Tuesday, September 05, 2006

Printing to PDF

Either or both of these:

PrimoPDF

CutePDF

I have found that the printer driver you chose makes a massive difference to the finished product, some are OK, and some are really crap.

The best driver I have found so far on XP is the latest built-in HP Postscript driver, (HP color LaserJet 9500 PostScript driver) which you can download from here

It's 11MB though, and you can get a 3.1MB one from here

I tried the ones from here or here but they don't want to let you print to the virtual local ports - either LP1 or COM1 or network printers - nothing else - I don't know how to seperate the renderer from the printing interface. :o(

The others I tried were not as good, particularly the "QMS ColorScript 1000 Level 1" which I found suggested here was truly pants!

The "Apple Color LaserWriter 12/600" which was recommended in the CutePDF FAQ was OK, but not great, the main body text of the first page I wanted to print came out in a rusty brown, not in black.

If you are making your PDFs from Word documents and want a PDF which has clickable links (like the index and web links) I'd recommend installing Open Office and exporting to PDF from OOWriter.

Useful applications

Dia rocks...
(I've tried WinFIG and it sucks)

GIMP for Windows & GTK+

Bits for screen...

Bits for screen

http://aperiodic.net/screen/

http://www.gnu.org/software/screen/

http://www.kuro5hin.org/story/2004/3/9/16838/14935




Cygwin:

screen for Cygwin

http://dellelce.com/code/screen/

http://www.cygwin.com/ml/cygwin/2005-05/msg00797.html




davekaufman.net::.screenrc
Heaviliy tweaked and full of goodies.

Was this the same as this one or a newer copy?:
http://pastebin.com/m152f025b
http://airto.hosted.ats.ucla.edu/wiki/index.php/Using_Screen


apple.com::.screenrc
More vanilla.

http://www.guckes.net/setup/screenrc

http://www.aperiodic.net/phil/configs/screenrc

http://nion.modprobe.de/setup/screenrc

http://home.insightbb.com/~bmsims1/Scripts/Screenrc.html
http://cafim.sssup.it/~giulio/other/gb.screenrc

TODO: Things you might like to do, things you might not want to do...