Tuesday, October 19, 2010

Delete Old Log Files On Windows

When administrating Windows hosts I always stumble upon stuff which I imagined should be simple, yet proves complex.
I recall I used to write a Perl script in order to delete log files which are older than X days. Today I found out that Windows servers (XP is not a server, so this doesn't work on XP) has this nice "forfiles" command that assists in doing that in a one-liner, as one could've expect.
Have a look here. This works like a charm

Wednesday, October 6, 2010

Going Cordless

My home PC/workstation has almost become my primary PC. I get to use it for pure work for about 30-40 hours a week. This is why the design of my home workspace has become more important for me than before.
I think that people who work with me knows I usually work in a well designed workspace, in which everything is nice and comfortable. The monitor is in the right size, the keyboard is placed in the right place, headphones are available at hand, the desktop (of the real desk) is clean, etc.

Ever since I work more at home, I noticed stuff is not as comfortable as I'm used to from my workplace. After some time I finally realized what bothers me, and made the adjustments:
  1. The correct distance from the monitor. I noticed that I'm actually sitting too far from my monitor, and from the desk as well. Sitting correctly forces me to sit with a "straight" back, not using the arm support of the chair, and strain my eyes less. The monitor should be about arm-reach away.
  2. My desk is now way cleaner.
  3. Cords. For a good reason this is the title of this post. I had tons of cords everywhere. I have so many devices on my desk and around it, that I got out of free USB connections (I have 8 slots). So I decided to go cordless. A bluetooth dongle and a USB hub did the trick. Now, I have a USB hub sitting on my desk, already with different types of cables connected (mini-USB, micro-USB, etc.), ready for devices to be inserted at need. No more USB extension cords. No more bending over to the PC in order to connect something. The next two bullets are about getting rid of non-USB cords.
  4. I love my laptop keyboard very much, and hate standard PC keyboards. I even posted a survey about it a while ago. After a search for a keyboard I'd like, and something cordless, I eventually settled on MS Wireless Desktop 3000. The mouse is big and solid, and not some toy-ish mouse, and the keyboard is soft and ergonomic and also reminds me of my laptop keyboard. I don't care about the rest of the functionality provided. The USB dongle required is tiny, and doesn't need an "eye" within the range of the keyboard, like other wireless keyboards. This is a big plus, since it doesn't require any cord to be stretched from the PC to the desk.
  5. Bluetooth headset. I hate my current headset. It has a cable that splits to the green and pink input jacks on the soundcard (speakers and microphone), and I can't stand up during work, to stretch myself, without accidentally pulling the cable. Now I await a DealExtreme delivery of Nokia BH-503, so I could go cordless in this field as well.
  6. Finally, a good, fast, WiFi router (supports N spec) is installed, so whenever I want to get away from the wires and the noise, and sit in my porch - I can.

Friday, October 1, 2010

Get Things Done

Recently I felt a huge decrease in my productivity. I noticed I'm trying to work on too many things at once, and not achieving anything. Moreover, I had to deal with a lot of pressure at work, while filling in the job of 2-3 people at once, while trying to cope with helping younger teammates to solve their own problems.

Actually, being distracted by teammates' questions can be a huge set back for productivity, as it breaks concentration when they approach you, and after 15 minutes, when I'm finally back in the zone, they break it again.

So I published this short survey on Buzz (which is a great tool for surveys) asking what other people do in order to stay concentrated and get things done.

The obvious answers were already known and implemented by me: put the headphones on, get away from everybody, etc.

Other answers were to manage a TODO list, and close any application that might distract you (GMail, RSS reader, IM, etc.). Even though I had those things in my mind for a while, I decided it's time to give it a go.
Boy was I surprised. My productivity peaked back to the top.

Now I allow myself to chat with people and "clear" my RSS list only after completing tasks. Every new task I get, and not only work related, is written down instead of being "managed" in my head. The reduction of tasks "managed" in my head really helps, and whenever I finish doing something, I revert to the list and mark something as DONE. The feeling is great, and there's a bonus: chatting or reading interesting blogs.

The TODO list is managed in a very simple manner: a Google Doc. And when I'm not near a computer: via my Nokia's task list, which is later sync'd to the Google Doc.
Another bonus: having everything managed, helps dealing with unpredictable tasks (aka BALTAM in Hebrew), since being distracted wastes less time when trying to get back on track. The proof for the system being successful is that ever since I started using is, I have more time to blog :)

Saturday, September 25, 2010

Keyboard is Faster

Do you know this guy that uses only VIM? Did he already told you he uses VIM because you can achieve everything using just the keyboard? No?

At the times I'm not at home/office, or at the times I want to watch the beautiful sunsets from my porch, I work using my laptop, instead of a regular PC. While I like the laptop keyboard far better than a regular keyboard, I hate the touch-pad. It's just not usable.

So whenever I work with my laptop, I get to learn some new keyboard shortcuts, since it is the only thing that keeps me sane.
Recently things got a lot better, since I started using the keyboard shortcuts provided by Google's products, especially GMail and Reader.

While GMail keyboard shortcuts requires you to turn them on via the settings, you get those for free in Reader. If you can't remember a shortcut, simply press "?", and you'll get a nice popup reminding you whatever there is you need to know.
What I like best in the combinations they chose, is that they remind me the shortcuts of UNIX utilities (yes, VIM included). I guess this was intended, and I'm thankful for that.

Thursday, September 9, 2010

So What's On Your Reading List

I had this post in my mind of quite some time, but couldn't find the time to write it. Good thing there are holidays.

Finding great people for hire is difficult. More than once an employer would be looking for people which are interested in what they do, and not just good at it. Such people would usually be more passionate at work, and work harder and better that others.

One technique not many employers are utilizing, is asking what's on the RSS reading list of the potential employee. Come to think about it, it's a great way to see what the person is passionate about.
It doesn't mean that if one goes to an interview at some company that does media streaming, should read media-streaming blogs. But if the person is going to be a programmer, and happens to be reading Coding Horror, that's a great plus.

A thing I like very much in my current workplace (M86 Security) is that we have a must-read reading list. That means that every team member receives an OPML file on the first day on the job that contains stuff that he must read on a daily basis.
This helps turning the team members into pro's, and will certainly help the company and our future careers.

Tuesday, September 7, 2010

Working With ToR In Python

I bet I'm not the first one who ever needed to write a script that downloads something via ToR.
Apparently, there isn't much information regarding how to request a new identity or how to use the ToR proxy in Python. So here's a gift from me to the world.

First, while not necessary, I always use a new ToR identity prior to download something through the ToR network. The code looks like:

import socket
def renewTorIdentity():
success = False
s = socket.socket()
s.connect(('localhost', 9051))
s.send("AUTHENTICATE\r\n")
resp = s.recv(1024)
if resp.startswith('250'):
s.send("signal NEWNYM\r\n")
resp2 = s.recv(1024)
if resp.startswith('250'):
success = True
return success

That would work assuming "authentication" is set to none in the Vidalia control panel.
After having a new identity, downloading a file is really simple, as Vidalia comes bundled with privoxy configured on port 8118. Here's a sample code for downloading something:

import urllib2
url = "http://something-to-download"
proxy_support = urllib2.ProxyHandler({"http" : "127.0.0.1:8118"})
opener = urllib2.build_opener(proxy_support)
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
response = opener.open(url).read()
That's it. Simple.

Wednesday, September 1, 2010

Blog Day 2010

After missing it last year, and in one day delay this year, I'm celebrating today the blog day.

So here is my list of recommended blogs, not ordered by any specific order:
  • Miguel De Icaza - While it is popular to hate MS technologies, I do think mono is a great thing and its founder a very smart person.
  • Paul Graham - The father of Y-Combinator. While not exactly a blog, this one is really interesting and insightful, especially to would-be entrepreneurs.
  • Doc's blog - Did it ever happen to you that you met someone with much to contribute to the world (in terms of blogging, but not only), that just didn't reach their potential (yet)? Well, I hope that this post will make Doc to publish more of his clever insights and musings.
  • Lessons Learned - Yet another must read for would-be entrepreneurs. Nothing I can add here.
  • ZuLL - Well, I can't deny the fact I'm part of the security industry in Israel, and Guy writes about interesting stuff.
Still, looking a bit back, it seems I removed more blogs from my reading list, than I added. I really hope I'll come across new and better ones this year, so I'll have novel things to recommend on next year.