my os x german word pool

I needed a list of german correct words to check some stuff for my BA Thesis.
Couldn’t find a way to get all words from the auto-correction function on OS X. I thought there might be a complete list of words which I simply read in and then check. But it doesn’t look like there is something.

So I do google and found out that translation files ending with ‘.strings’ located at the ‘lproj’ folder contain translations for the internationalization. The only thing I need is to make a list of those files, then go through this list and extract the german translation words. I don’t care about double word’s because the can be filtered out later easily.

So here is my Script:

#!/bin/bash
B=$IFS;
IFS=$'\n'
for i in $(locate .lproj | grep "German" | grep "\.strings" | grep -v InfoPlist)
do
for line in $(cat $i | grep --binary-files=text -v "/" | grep --binary-files=text "=")
do
IFS=" "
for word in $(echo ${line//[\"-\+\.,:=;&\)\(%,@1234567890]/} | awk '{ $1=""; print  }')
do
if [ ${#word} -gt 1 ]; then
echo $word >> ~/Desktop/iMacDELang.txt;
fi;done
IFS=$'\n'
done;done
IFS=$B

For other languages just replace “German” in line 4 with your desired language.

Execution takes about 5 mins and I end up with a list of ( after filtering ) 43756 uniqe german words.
This was enough for my first test, later on I do really need a complete list of all words. Tthis would be great

apache performance/DoS bash test

just had to download a bunch of files from a webpage. So I wrote a little script which does this for me:

 

for i in $(lynx -dump -listonly -auth=USER:PASS-ag “http://…….” | grep “http”); do
x=$(echo $i | grep “^http”);
if [ ${#x} -gt 0 ]; then
    wget ${i/http:\/\//http:\/\/USER:PASS@} -O ${i:60:8}
fi; done

maybe not the best but it works.
Using my new favorite I replace the fourth line with

    echo “wget ${i/http:\/\//http:\/\/USER:PASS@} -O ${i:60:8} &” | /bin/bash
resulting in a high speed download but after aprox. 150 files download just stopped
? whats happening, sometinhg wrong in my script, where is the error …..

how to kill your bash

I have a wlan router in my LAN where I switched of the WLAN functionality because I have a faster one. Today I wanted to get access to the admin interface of the router. The problem was I forgot the ip adress of the router.
So I’m trying to write a little script which pings all hosts in my ip range and prints out the ip if the host exists.
I came up with this:

    > for i in $(seq 1 255); do 
    > ping -c 1 -q -t 1 192.168.0.$i | grep -A1 -B1 ” 0%” | head -n1
    > done

Continue reading “how to kill your bash”