Tuesday, January 18, 2011

SSH Escape Sequences

To show the escape sequences, hit shift + ` + ?
[someuser@hanworks ~]$ ~?
Supported escape sequences:
~. - terminate connection (and any multiplexed sessions)
~B - send a BREAK to the remote system
~C - open a command line
~R - Request rekey (SSH protocol 2 only)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

Monday, January 03, 2011

XML and Lisp

Just digging up the old debate on XML being a form of Lisp...


alloca (in C) allows you to dynamically allocate memory on the stack!

Here is a example:

Note that using this function isn't really good practice. If there is a stack overflow, the behavour is undefined. But there are advantages of using alloca as well.

Further reading: an alternative to alloca: obstacks

Sunday, January 02, 2011


Again, random titbits:

1. PAE allows a 32-bit OS to use up to 64 GB of RAM. To utilize this, make sure your cpu supports PAE, and you have to install a PAE-aware kernel.
But there is a possible performance hit (that may not be significant)?
What is the overhead, in terms of space and time, of using a PAE enabled kernel as compared to an SMP kernel?

PAE doubles the size of page table entries from 32 bits to 64 bits, as well as adding a small third level to the page tables. This means the maximum amount of kernel memory consumed by page tables per process is doubled to slightly more than 6MB. In the 2.4.18 kernels shipped by Red Hat, this memory comes out of the ~700MB of available memory in the normal kernel zone. In the Red Hat Linux Advanced Server series of kernels, page tables can be located anywhere in physical memory.

The performance impact is highly workload dependent, but on a fairly typical kernel compile, the PAE penalty works out to be around a 1% performance hit on Red Hat’s test boxes. Testing with various other workload mixes has given performance hits ranging from 0% to 10%.

Source: Redhat white paper

2. top has these shortcut keys: shift-A (to see all fields) and shift-G (to see field groups)
3. pinfo is a nice tool if you don't like info
4. My emacs and vim config files (a follow up from here)
5. Restoring a single file in hg: $ hg cat somefile.c > somefile.c
6. indent is a nice tool... but be careful what you do with it.
Sample usage: $ indent -kr -nut somefile.c
You can also put your settings in a .indent.pro file in the directory of your source code.