Sunday, October 28, 2007

Ubuntu - core dump

From https://answers.launchpad.net/ubuntu/+question/10616
It appears that resource limits (which include the maximum size of a core dump file) are set by PAM on login. The settings for these limits are in /etc/security/limits.conf, which on my system (which is unmodified) is comments only. A quick look at the source code suggests that the default core dump limit is 0 (zero), which means no dump at all is created (even though the message suggests otherwise).

In summary: edit /etc/security/limits.conf, set the core limit to be non-zero (measured in kilobytes), and log in again.

I hope that works!

Thursday, October 11, 2007

VIM - omnicppcomplete

I had to put these in my ~/.vimrc to get omnicppcomplete to work
autocmd BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main

"ctags
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

"omnicppcomplete
imap <C-Space> <C-x><C-o>
let OmniCpp_MayCompleteDot = 0
let OmniCpp_MayCompleteArrow = 0

VIM - NERDTree plugin

Good file explorer.

plugin: link

Add this to ~/.vimrc
"NERDTree Toggle
noremap <Leader>][ :NERDTreeToggle

Tuesday, October 9, 2007

Ubuntu - Install dev man pages

sudo apt-get install manpages-dev manpages-posix-dev

Tuesday, October 2, 2007

Linux - xbindkeys for Logitech G5

This is my ~/.xbindkeysrc for my Logitech G5:
"/usr/bin/xvkbd -xsendevent -text "\[Return]""
m:0x0 + b:8
"/usr/bin/xvkbd -xsendevent -text "\[Alt]\[Left]""
m:0x0 + b:7
"/usr/bin/xvkbd -xsendevent -text "\[Alt]\[Right]""
m:0x0 + b:6

Additional help: link

Thursday, September 20, 2007

Eclipse - Last Edit Location

Keyboard shortcuts:
Last Edit Locationctrl+q
Next Edit Locationctrl+.

Monday, September 10, 2007

GVIM - Enable horizontal scroll bar

Add this to your .vimrc:
set guioptions+=b

Wednesday, September 5, 2007

UNIX/LINUX - Customized bash prompt

If you want your bash prompt to look like this:

[10:27:57 AM] hostname:~/some_dir
$

Put this in your .bashrc:
function proml
{
local BLACK="\[\033[0;30m\]"
local RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local YELLOW="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local PURPLE="\[\033[0;35m\]"
local CYAN="\[\033[1;36m\]"
local WHITE="\[\033[1;37m\]"

case $TERM in
xterm*)
local TITLEBAR='\[\033]0;\h:\w\007\]'
;;
ansi*)
local TITLEBAR='\[\033]0;\h:\w\007\]'
;;
*)
local TITLEBAR=''
;;
esac

PS1="${TITLEBAR}
${GREEN}[\$(date +%r)] ${RED}\h:${YELLOW}\w\
${WHITE}\n$ "
PS2='> '
PS4='+ '
}
proml

You can change the colors and other properties as well.

Tuesday, September 4, 2007

X11 - Dell 2405fpw xorg.conf

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 30.0 - 110.0
VertRefresh 50.0 - 150.0
Option "DPMS"
Modeline "1920x1200" 154.128 1920 1968 2000 2080 1200 1203 1209 1235 -hsync -vsync
EndSection

Section "Device"
Identifier "Device0"
Driver "nv"
VendorName "NVIDIA Corporation"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1200" "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Thursday, August 23, 2007

VIM - Search to end of word

This will leave your cursor at the end of the searched phrase:
/search phrase/e

Monday, August 13, 2007

VIM - format lines to certain width

First,
:set textwidth=80 (or :set tw=80)
Then,
gqqFormat a single line
{Visual}gqFormat visual selection. (ctrl+v to get to visual mode then use hjkl to navigate)

For more help,
:help gq

Sunday, August 5, 2007

Compile Pidgin for Ubuntu 7.04

Download source: http://www.pidgin.im/download/
Install dependencies:
sudo apt-get install gettext libglib2-dev libgtk2.0-dev libxml2-dev
For MSN and GoogleTalk:
sudo apt-get install libnss-dev libnspr-dev
Compile:
./configure
make
sudo make install
make install clean

Sunday, July 8, 2007

Mouse gestures

What is a mouse gesture?

They can probably be explained better with an example:
Say you wanted to scroll down on a webpage using your mouse. Normally, you would point your mouse cursor to a scroll bar and clicking on it. Using mouse gestures, you would click and hold on to the right mouse button, move the mouse cursor down a little bit, and then let go of the button.

What are the advantages of mouse gestures?

First off, you don't need to point to any user interface element; thus, mouse gestures save time by minimizing mouse movement.
Most mouse gesture programs allow you to customize what your mouse gestures do. For example, if you did not want the down gestures to scroll down, you can change it to do something else such as changing tabs.

How do I add mouse gestures?

For Windows: StrokeIt
For Firefox: All-in-One Gestures
Other: wikipedia entry

Friday, June 22, 2007

Excel - Custom page numbering


  • View → Header and Footer...
  • "Custom Header..." button
  • Type these into any one of the sections:

    InputResult for page 1
    &[Page]+5&6
    -&[Page]+5--6-
    [&[Page]+5][6]
    (&[Page]+5)(6)

Wednesday, June 20, 2007

VIM - minibufexpl

Script: minibufexpl.vim
"MINIBUFEXPLORER Stuff (Enter "\mbe" minus quotes quickly to bring it up)
""Commands:
" Ctrl-PgDown - goto next buffer
" Ctrl-PgUp - goto prev buffer
" \-Backspace-= - toggle minibufexplorer
"let g:miniBufExplMaxSize = 3 "allow up to 3 lines of buffers
let g:miniBufExplModSelTarget=1
"map mbo :MiniBufExplorer
noremap :bn
inoremap :bn
cnoremap :bn
noremap :bp
inoremap :bp
cnoremap :bp
noremap = :TMiniBufExplorer
noremap u :UMiniBufExplorer

set hid "Hide abandoned buffers in order to not loose undo history

Monday, June 18, 2007

KDE - Default browser

$ kcontrol
KDE Components → Default Applications → Web Browser
Under Default Component, choose "In the following browser"
Type in: firefox (or your browser of choice)



Then go to KDE Components → File Associations.
Go to Text → html.
Click Firefox and press the Move Up button.

Wednesday, June 13, 2007

LINUX/UNIX - inputrc options

Add this to your ~/.inputrc to
# get default system bindings
$include /etc/inputrc

# ignore case on tab complete
set completion-ignore-case On

# prefer visual bell
set prefer-visible-bell

Tuesday, June 12, 2007

Perl - Find and replace all

Find cpp and hpp recursively from the current directory then append those files onto the perl command, which substitutes "old" for "new" in those files while creating .bak backups.
find . -name "*.[ch]pp" -type f | xargs perl –i.bak –p –e 's/old/new/g;'

or non recursive:
perl -pi -w -e 's/search/replace/g;' *.php
-e means execute the following line of code.
-i means edit in-place
-w write warnings
-p loop

Thursday, June 7, 2007

VIM - Multiple highlighted searches

Script link
:Search <pattern1>
:Search <pattern2>
:SearchReset