Searching for all ebuilds with specific useflag in Gentoo

Ever wondered how to find all those programms in portage you didn’t install, which have a specific useflag you were interested in ?

Well, eix is capable of this useful feature, just search like this:

eix -U someuseflag

Compare Directories with diff

Its easier than i thought, just type:

diff -rq Dir1 Dir2

-r stands for rekursive

-q output only wether content differ

Mounting ext4-filesystem with newer Kernels

Trying to mount my ext4 partiton with a 2.6.25 kernel i get this errormessage:

EXT4-fs: hda3: not marked OK to use with test code.

There is a new special flag you have to set to mount development code, so do:

[root]# debugfs -w /dev/hda3
debugfs 1.40.9 (27-Apr-2008)
debugfs: set_super_value s_flags 4
debugfs: quit

More info here.

Syncing your portage tree and overlays with eix

If you want to sync your portage tree and your layman-overlays with one command, you can use
eix-sync
for that.

All you have to do is to create
/etc/eix-sync.conf
and place a
*
in it.

If you want to have a cronjob for that create for example a file named /etc/cron.weekly/eix.cron

and put something like

#!/bin/sh
/usr/bin/eix-sync

in it.

You can then delete all other cronjobs like emerge –sync and layman -S

As usual man eix has all the info you need.

Java not working when libX11 compiled with xcb useflag

Put

LIBXCB_ALLOW_SLOPPY_LOCK=1

in your /etc/env.d/99local

Enable Antispoofing With Iptables

for i in /proc/sys/net/ipv4/*/rp_filter; do
echo 1 > $f
done

Or simply

echo 1 > /proc/sys/net/ipv4/*/rp_filter (depends on your shell)

This compares the source adress against the routing table

More info about the ~50 options you can find at /usr/src/linux/Documentation/networking/ip-sysctl.txt

HowTo Redirect And Save Tcpdump Output To Other Host

So you have one of those fancy Linksys-Routers with OpenWrt on it and want to save the output of tcpdump. As the local storage is limited and OpenWrt does not support a monitoring-port you have to redirect the output to save on another host.

But first lets enlarge onto that monitoring-port.
For what i know DD-Wrt’s iptables supports by default the ROUTE target with the --tee parameter:

--tee
Make a copy of the packet, and route that copy to the given destination. For the original, uncopied packet, behave like a non-terminating target and continue traversing the rules. Not valid in combination with ‘--iif' or '--continue

I tried to patch OpenWrt’s iptables with the ROUTE target, but no luck as this extensions seems not to be maintained anymore.

As DD-Wrt is OpenWrt-based, i supose i only need the ipkg from them and can install it on my router, have to investigate that further.

Far less complicated is to start tcpdump on your router and redirect the output to your PC like this:

tcpdump -i any ! host 192.168.1.2 -s 0 | ssh someone@192.168.1.2 “cat > dump.txt”

Change tcpdump filters to your liking.

Enable And Disable Spell-Checking In Vim

First you choose the language which you want to use:

:setlocal spell spelllang=en_us

or

:setlocal spell spelllang=de_at

For the German spell files you have to:

emerge vim-spell-de

You can disable spellchecking with:

:set nospell

]s move to next misspelled word, [s move to prev. misspelled word
z= suggests correctly spelled words under cursor,
1z= takes the first word from the suggestion list
^Xs does the same in insert mode.
:spellr repeats replacements done with z= for all matches

For more info about spellchecking in vim:

:h spell

Rename Or Copy Files Not In Current Directory

: I often cached myself renaming a file in some other directory like this,
: mv some/dir/some/file some/dir/some/file_renamed.
:
: But there is an easier way:
: mv some/dir/some/{file,file_renamed}
:
: This also works for copying:
: cp /etc/mail/{sendmail.cf,sendmail.cf.orig}
:
: Or vimdiff:
: vimdiff /etc/mail{sendmail.cf,sendmail.cf.orig}
:
: And thats why I love zsh so much, you can even tabcomplete after the {, try that in bash f.e. :)
: Be creative, I’m sure there are many useful fields of application

Advanced Command-Line Editing

: Today I passed my 117-201 exam and now I play a little bit with the Vi
: key bindings on Zsh. In Bash you can set them with set -o vi, and in Zsh you
: can set them additionally with setopt vi.
:
: I want to get to the point of command line editing above the basic
: tab complete and history browsing, searching and minor corrections. So I
: start witch a little example:
:
: I want to rename a file with the following naming scheme:
:
: someID_filename.txt to filename.txt
:
: After my fulminant efficient Vim key combination for table editing, (see this article)
: I challenge everybody to find the shortest key combination to fulfill this
: task.
:
: I start with an self-deprating solution:
:
: First I type:
: mv someID_filname.txt
:
: Now the count begins:
:
: <Space><Esc>T_y$$p<Enter>
:
: This makes a total of 9 characters which i have to store in my brain. As I want
: to have my head free for more complicated tasks, of course this has to
: be optimized dramatically :)
:
: Have fun.