Uncategorized

Povi Päris Pythoni Progremise Päevad

Posted by on Jul 25, 2011 in Uncategorized | 0 comments

Povi õpetab Pythonit progema! Kooliõpilastele-õpetajatel?e ja Povisse praktikale tulevatele üliõpilastele tasuta!

 

Day #1: My solutions

 

Apache log analyzer

#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'Ando'

print "Apache log analyzer"

lines = 0

os = {'win': 0,
      'linux': 0,
      'mac': 0,
      'unknown': 0
} # 3 major OS-s

percentages = {'win': 0,
               'linux': 0,
               'mac': 0,
               'unknown': 0
} # Holds the percentages

fail = '/var/log/apache2/access.log'
print "Logfile is ", fail

for line in open(fail, 'r').readlines():
    if (line.find('Linux') != -1):
        os['linux'] += 1
    elif (line.find('Windows') != -1):
        os['win'] += 1
    elif (line.find('Mac') != -1):
        os['mac'] += 1
    else:
        os['unknown'] += 1
    lines += 1

print "Number of log entries:", lines
print ""

for name in os:
    if (os[name] > 0 and lines > 0):
        percentages[name] = (os[name]*1.0 / lines*1.0) * 100

    print name.upper() + ', %i times, %f%%' % (os[name], percentages[name])

print "nEND"
Read More

SMS-gateway

Posted by on May 1, 2011 in Uncategorized | 0 comments

Tele2 pakub kuumaksuga e-mail-to-SMS gateway teenust. Vägev! Kusjuures öeldi, et kõik SMS-d on tasuta, maksta tuleb ainult kuumaksu eest.

Oleks mul vaid virtuaal-privaatserver kuskil pilves…saaks häkkerdada selliste asjadega nagu ITK-Notifier

Read More

New mail in inbox!

Posted by on Apr 24, 2011 in Uncategorized | 0 comments

Since the invention of e-mail, geeky people have found various creative and sometimes annoying ways to notify themselves of a new mail in their inbox.

Say, for example, that you have a roomie who left his laptop locked and the volume up and it just so happens that he had a very vocal Indian dude announcing his full inbox every 3 minutes.

This would be my remixed reply to that.

Download

Read More