Disable the Recent Documents Menu in Gnome

posted by Arkham on May 30th, 2008

cd
su
rm -i .recently-used*
chattr +i .recently-used.xbel

;)

Tags: , ,

MIA: Firefox titlebar icon

posted by Arkham on May 30th, 2008

I just installed firefox3 beta and I realized that the little icon in upper right corner of the application (the titlebar) had just disappeared leaving a pretty sad spot in my eyesight.
After symlinking a hundred of different images in $FIREFOX_DIR and /usr/share/pixmaps I finally discovered the right one:

cd /opt/mozilla/lib/firefox-3.0/
mkdir -p chrome/icons/default/
cp icons/default.xpm  chrome/icons/default/default.xpm

If the same problem happens while you’re using the normal Firefox just change /opt/mozilla/lib/firefox-3.0 into /usr/lib/firefox ;)

Tags: , ,

Raising elephants…

posted by Arkham on April 28th, 2008

Today, out of the blue, my system freezed.
So, once for all, I decided to enable Magic SysRq keys.

echo "1" > /proc/sys/kernel/sysrq

If my system would ever freeze again, I will start raising elephants…

R -> put the keyboard in raw mode
E -> terminate all processes gracefully
I -> kill all processes
S -> sync the disk
U -> umount all filesystems and remount them read only
B -> reboot the system

In a sentence:

Raising
Elephants
Is
So
Utterly
Boring

Tags: ,

Vim staircase effect

posted by Arkham on February 28th, 2008

If you are terminal vim users, I’m sure you have tried to copy/paste text into a file and thought “Wtf, this is pretty damn wrong” seeing something like this:

void
randomize (void)
{
       struct timeval *tv = malloc (sizeof (struct timeval));
            struct timezone *tz =
                  (struct timezone *) malloc (sizeof (struct timezone));
                 gettimeofday (tv, tz);
                      srand (tv->tv_usec);
                           free (tv);
                                free (tz);
                            }

That’s called vi staircase effect.

The solution is to type:

:set paste

before pasting and

:set nopaste

after finishing.

Alternatively, just add to your ~/.vimrc:

nnoremap <silent> <F12> :set paste!<CR>

to press F12 for toggling between paste and nopaste conditions.

Tags: , ,

GNU Screen cheat-sheet

posted by Arkham on January 26th, 2008

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

Basics:

  • Ctrl+a c -> create new window
  • Ctrl+a A -> set window name
  • Ctrl+a w -> show all window
  • Ctrl+a 1|2|3|… -> switch to window n
  • Ctrl+a “ -> choose window
  • Ctrl+a Ctrl+a -> switch between last two windows
  • Ctrl+a n -> switch to next window
  • Ctrl+a p -> switch to previous window
  • Ctrl+a d -> detach window
  • Ctrl+a ? -> help
  • Ctrl+a [ -> start copy, move cursor to the copy location, press ENTER, select the chars, press ENTER to copy the selected characters to the buffer
  • Ctrl+a ] -> paste from buffer
  • Ctrl+a : screen foo -> create a new window executing foo and set its name

How to use screen:

  • screen -ls -> list of detached screen
  • screen -r PID -> attach detached screen session
  • screen -S MySession -> start a screen session with name MySession
  • screen -r MySession -> attach screen session with name MySession
  • screen -S MySession -md /usr/bin/foo -> start a screen session called MySession, launching /usr/bin/foo inside of it, and then detach it
  • screen -DR -> if a session is running, reattach; if necessary detach and logout remotely first. If it was not running, create it

Advanced:

  • Ctrl+a S -> create split screen
  • Ctrl+a TAB -> switch between split screens
    If you created a new split screen, the current window is empty. either select an existing window (ctrl a “) or create a new split screen (ctrl a n).
  • Ctrl+a Q -> Kill all regions but the current one.
  • Ctrl+a X -> remove active window from split screen
  • Ctrl+a O -> logout active window (disable output)
  • Ctrl+a I -> login active window (enable output)

Tags: , ,