The 'lsscsi' command lists the scsi drives attached to your system.
ubuntu (aptitude install lsscsi)
Also checkout the file
/proc/scsi/scsi
and the command hwinfo --scsi
dinsdag 30 september 2008
maandag 22 september 2008
trac Integrety Error
If your trac starts giving you Intgrety Errors try to do a:
trac-admin /your/trac/path resync
maandag 1 september 2008
loop throught files with bash
For-in loops don't work well when you have filenames with spaces in them
#!/bin/bash
ls *.pdf | while read i; do
j=`echo $i | sed s/\.pdf/\.swf/`
pdf2swf "$i" -o "$j"
done
donderdag 28 augustus 2008
ssh X forwarding on your server
If you have an ubuntu/debian server running and want to run X apps through ssh -X you should "apt-get install xauth" for this to work.
woensdag 27 augustus 2008
tortoise SVN
In some cases tortoise svn (windows svn client) can't do checkouts of your repository and the following message is displayed:
"Not authorized to open root of edit operation"
Adding the following line to your svnserve.conf solved the problem for me:
"anon-access=none"
"Not authorized to open root of edit operation"
Adding the following line to your svnserve.conf solved the problem for me:
"anon-access=none"
woensdag 13 augustus 2008
Hollandse hitmachines
Voor al uw nederlandse artiesten en hollandse hitmachines
http://www.watzitjenoutekijken.nl
http://www.watzitjenoutekijken.nl
convert int to a separate bytes
def intToBytes(self,n, bytecount):
""" returns the binary of integer n, using count number of digits """
str = ""
i=bytecount-1
#8 bit mask
mask = ~(sys.maxint^(pow(2,8)-1))
while i >= 0:
str = str + chr((n>>(i*8))&mask)
i-=1
return str
""" returns the binary of integer n, using count number of digits """
str = ""
i=bytecount-1
#8 bit mask
mask = ~(sys.maxint^(pow(2,8)-1))
while i >= 0:
str = str + chr((n>>(i*8))&mask)
i-=1
return str
dinsdag 12 augustus 2008
convert bytes to an integer in python
ran into a situation where i had to convert some bytes to an integer value in python. This func does the trick. The mask is only used to have a counter of the same length counting backwards (hence the negation).
def bytesToInt ( self, bytes ):
""" convert certain amount of bytes to an integer """
size=0
i=0
mask = sys.maxint&(len(bytes)-1)
while i < len(bytes):
size = size|ord(bytes[i])<<((~i)&mask)*8
i+=1
return size
def bytesToInt ( self, bytes ):
""" convert certain amount of bytes to an integer """
size=0
i=0
mask = sys.maxint&(len(bytes)-1)
while i < len(bytes):
size = size|ord(bytes[i])<<((~i)&mask)*8
i+=1
return size
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.
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.
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.
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
$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.
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
~$ 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
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:
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
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
Abonneren op:
Posts (Atom)