Tag Archives: tips

Blackberry email reading tips

  1. This is my favorite: If you press J and K on the email list or while reading the email, it moves between previous and next emails in the context. (just like in the vi 😉 )
  2. While reading and email, if you press N it goes to the next email, P to the previous email. And if you press same keys on the email list, it goes next day and previous day consecutively.
  3. Space key and Shift+Space key scrolls page by page the email list, or the email.
  4. T and B are shortcuts for Top and Bottom, no more scrolling like crazy to go to the end of an email 🙂
  5. R is to Reply, L is to Reply All.
  6. U is to go to the oldest unread messages.

I hope this is useful 😉

Call reports in FreePBX

I’ve been having hard time to understand the CDR reports from FreePBX. There were a lot of duplicates, lots of couple of second connection entries, etc… All I needed is to set a criteria and see the reports related to that criteria.

So here is how it goes:

  • I need only ANSWERED calls.
  • I need only calls longer than 30 seconds.
  • I need last 24 hours and also last month call reports.
  • I want the script to be able to run on cron whenever I want to, so the output should be purely “emailable”
  • At the end of the report I need the total talk time.

So I came up with this perl script. If you need similar stuff, please don’t hesitate to use it.

Here is a little howto:

First you need to edit the script to fit your database settings, it’s pretty self explanatory in the script itself.

  • cdrreports -d gives you the daily report (or the last 24 hours to be more precise)
  • cdrreports -m gives you the monthly report (or the last 30 days to be more precise)
  • if you run cdrreports without any arguments, it will give you all the calls you made so far.

Lastly, the way I use this script is by running from two cronjobs. One at night for the last 24 hours, and one every 1st day of the month for the monthly reports. It’s up to you how to use it 😉

Moved to my new blog

I’ve been planning this for a while. I had written my own blog engine, it’s been bits and pices of code I’ve been patching to each other with band aid and chewing gum…

It was good for late 90s and early 2000… However the net changed, I had to move on, I didn’t update my blog code accordingly, it became sluggish, I became sluggish… No updates on my blog, no updates on my code… So I made one last leap and wrote a small perl script to port my contents to wordpress. It went OK. The content was there, well, at least the text part of it.

The images were another story. I was too lazy to write regexps to cover all my possible images in the content while importing. So I used some mod_rewrite tricks. I think it covered most of my image content.

I preserved the same story ids while importing, this gave me a lot of flexibility on the content that are “famous” on my blog: Like this one, and this one. They were contents that were constantly searched and linked. I couldn’t afford to lose them. So some more mod_rewrite magic needed. Like converting links like http://emresaglam.com/blog/haber.php?id=183 to http://emresaglam.com/blog/183

In the end, I spent almost equal time writing my perl script and my mod_rewrite rules 🙂 (for mod_rewrite: 3 lines to cover RSS, 5 lines to cover image contents plus friendly urls and backward compatibility) I’ll share them sometime when I’m not lazy.

Well, hopefully I’ll go back writing stuff again 🙂

İngilizce windows’da türkçe harfler.

Eğer siz de benim gibi ailenize Amerika`dan ucuz laptoplar getirip ingilizce windows kullanmak zorunda kalıyorsanız, türkçe harfleri bazı durumlarda görüntülemeniz zor olabilir. Bu durumlar için çok basit bir çözüm var.

Start -> Control Panel -> Regional and Language Options seçeneğine gidin. Açılan pencerede Advanced sekmesine klikleyin. Language for non Unicode programs kısmında ise Turkish seçin. Aşağıdaki ekran görüntüsünde olduğu gibi yani. 🙂

Windows Language settings

python and resolving ips from a csv file.

Problem: I have a CSV file where I have source and destination IPs. I want to resolve only destination IPs.

Format of my CSV file: (let`s call it test.csv) (it`s tab separated…) 118340.86 187

The solution is pretty simple with python:

#!/usr/bin/env python
import csv
import socket

reader = csv.reader(open(“./test.csv”, “rb”), delimiter=” “)
for row in reader:
host, aliases, ips = socket.gethostbyaddr(row[1])
print row[0] + ” ” + host + ” ” + row[2] + ” ” + row[3]

First we import the necessary libs. (socket and csv)

Then we open the file to read with as a csv object. (Careful because our delimiter is not comma, but TAB)

for each row we get the second row (row[1]), convert it to host, alias and ip by gethostbyaddr method.

The last line is to create the new tab separated format. (Just pipe it to a file and you have your new CSV file. [tab separated… but oh well..])


How to clean the activexdebugger32.exe virus

From Emre virus labs:

This motherfucker virus was living in my parents` computers. (Since I use Linux I don`t have any as usual…) And it`s a pain in the ass…

What the virus does:

  • Shares your drives to the world as PATRON1, PATRON2, etc…
  • Copies itself to any writeable devices around you. USB sticks are great examples.
  • On a USB drive, it generates an autorun.inf file and a copy of itself. Each time you connect your USB drive it infects your computer again…
  • It uses the CPU at least to 70%… Noisy bitch…

How do you know that you are infected:

  • Press CTRL+Shift+Esc buttons. You`ll see the activexdebugger32.exe process running.
  • You can see a copy of the executable (activexdebugger32.exe) in your USB drives if you enabled the STUPID Windows to show you hidden files.

How to kill the bastard and have a nice smiley day/night (It`s 3am ok?) If you kill your computer i`m not responsible.

  • Plugin your USB stick (if you have one)
  • Kill the process activexdebugger32.exe
  • Delete the activexdebugger32.exe binary. It usually lives under c:windowssystem32 (or c:winntsystem32 depending your Windows installation)
  • open regedit. Go to the top of the tree on the left pane. hit F3 (or CTRL+L) to open the search dialog. type, yes you know it, activexdebugger32.exe, NUKE the damn registry entries wherever it`s found. (Search until the end)
  • Go to the root folder of your USB stick and delete, yes you`re right again, activexdebugger32.exe and autorun.inf
  • Update: Motherfucker leaves more trails… Delete the file NESNELER.EXE (meaning objects.exe in turkish) under c:Documents and SettingsLocal SettingsTemp
  • Update: Delete all the files under C:windowssystem32 named: Ijl11.dll, KMON.OCX, KTKBDHK3.DLL, MSWINSCK.OCX, PAC, scrrntr.dll, scrrun.dll
  • Done.

Lastly, fuck microsoft and windows, have a nice life….

Update after 4 months: Damn I was angry when I wrote this. And it was 3 am. The entry was somewhat full of typos so i edited and changed some info. 😛