woensdag 23 juli 2008

rolling back with svn

Say you want to rollback (parts of) your svn repository to a certain revision. This can be done with svn merge.

it works like this:

$ svn merge -r 1481:1373 svn+ssh://your.host.com/srv/repos/subdir

where the first number is the current revision and the second number is the revision you want to 'rollback' to.

A list with changes should appear (also use svn status for this). If you think you're done do a commit and the changes will be done on the repository.

vrijdag 11 juli 2008

tcpdump

for ftp traffic
tcpdump -A -i eth0 tcp port 21

comes in handy when you want to see what passwords are used.

WEP cracking with aircrack-ng

Open three terminals

terminal 1:
$airodump-ng -c 4 --bssid FA:KE:FA:KE:FA:KE -i -w jah eth1

This is an exmaple that dumps only weak iv's (channel 4) interface eth1 from the AP with this particular BSSID

You can also do a scan for WEP AP's first by running "airodump-ng eth1" without any further args.

If you're seeing some traffic between the AP and the client (use bssid for reference). use aireplay like this (in the second terminal):

$aireplay-ng -3 -b FA:KE:FA:KE:FA:KE -h FA:KE:FA:KE:FA:KE eth1

the three means you're doing ARP. The -b is the AP. The -h is the client.

If you leave this running for some time you can use the third terminal to run aircrack on the .ivs file airodump-ng created. It'll try to crack the key every now and then so you can leave it running.

maandag 30 juni 2008

filenames beginning with a - (dash)

If you want to (for example) cd to a file starting with a dash (some mac users tend to use weird filenames like "-folder" ). do

$cd ./-folder

removing files matching a certain pattern

from the xargs man:

delete all .svn folder

$find /somedir -name .svn -print0 | xargs -0 /bin/rm -rf

xargs comes in handy when handling great amounts of files.

donderdag 26 juni 2008

replacing text in a bunch of files matching a certain pattern

Replace comes with mysql. It's a handy tool for sed/awk n00bs. This one I used to change some static paths while excluding all .svn folders and logfiles.

~$ replace '/var/www/mydir' '/var/www/newdir/' -- `grep --exclude-dir=.svn --exclude=*.log -clr "/var/www/mydir" ./*`

Of course there are other/better ways to accomplish this, look at this
http://www.brunolinux.com/02-The_Terminal/Find_and%20Replace_with_Sed.html

dinsdag 24 juni 2008

ejecting a cd from a mac (running OS X)

Before rebooting try in terminal:

$drutil eject

donderdag 19 juni 2008

page up / page down bash

add these lines to your /etc/inputrc to search backwards through history. It searches on the string already typef


"\e[5~": history-search-backward
"\e[6~": history-search-forward

woensdag 18 juni 2008

example post commit hook

Sample script for a conditional post-commit hook in bash. This post-commit hook updates a local copy (www directory) to the latest revision when files are changed within a certain directory.

#!/bin/bash
umask 0002

REPOS=$1
REV=$2
MATCH=`/usr/bin/svnlook -r $REV dirs-changed $REPOS | /bin/grep -c "just a string"`

if [ $MATCH -gt 0 ];then
/usr/bin/svn update /var/www/projects/mysite
fi

maandag 16 juni 2008

Never create a PagesController in Cake

While fiddling with cake. I got some weird error in my PagesController:

You are seeing this error because the action display is not defined in controller PagesController"




Whatever I did, it kept asking for a default view. After some searching it seems the PagesController is reserved for cake itself.


Reference: http://logs.cakephp.nu/cakephp/chat.log.2007-06-26