This forum is in archive mode. You will not be able to post new content.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - madara

Pages: [1]
1
Scripting Languages / Re: Python Port of Word List Generator
« on: October 10, 2013, 05:13:45 PM »
HI Deque , good speech 8) 
you’re right, I meant compilation  directly in machine language like in C/C++..ecc..not in IL..
I repeat: obviously Python is slower then *pure compiled* languages , and ok its VM  hasn’t JIT like in Java or in .net runtime(ps. however look at PyPy  just in time compiler for Python...good but not comparable to JIT)..…but it take advantage of powerful  libraries like  itertools,  numpy package and many others as you know…there would also *stuff* like  Cython and Numba (for scientific computations) to speed up your code… all this is Python;
but in conclusion  what matters is muster an  efficient practice   coding as you said

Semantic of code   that I posted is very simple, and self –explanation,.. obviously  he  must know WELL built in  func and methods like map, expression gen, list comp., ecc… If not à  ther’s documentations and good books  for that.You can’t write good code without know basis…in a boring week end ... :D
it’s also important to think over  simple or complex code with own head, and after he could ask for clarifications

Why Python isn’t java or php..?;

Because if You think in Java when write Python's code probably you’ll produce inefficient code…
If you think in php when write python or php's code : surley  you’ll produce very inefficient  code  ;D

2
Scripting Languages / Re: Python Port of Word List Generator
« on: October 09, 2013, 10:24:05 PM »
I should lead you to the ganja shop!
can be an idea  ;D


ok, I have my ways that may seem uncomfortable but I  always say what I think but this is not a lack of respect...
remeber that I do not judge people, but what they say...it's very different...


we are here to learn not for the glory and touchiness does not allow the evolution , is it? ;)

3
Scripting Languages / Re: Python Port of Word List Generator
« on: October 09, 2013, 09:56:03 PM »

 Actually I deleted your post. It only said "PLEASE......", which is completely useless.
 

my post was an implicit  *comment* (too complicated to understand?..)
""get your own informaton before....ecc..."""
ok, i'm agree  --> sorry to Kulverstukas for that...but Kulverstukas...
when you say "my post ar right and your curved"...You confirm that you do not know the subject..Please learn before comment

 Second, Kulvertukas is actually right. Python is known (it's a fact) for being slower than other languages, you can't deny that!
Phage obviously Python is slower then a compiled language, such C ,, CLisp & company but also C/C++ are slower then Assembly, or CLR…then you prefer write your SW in pure machine language?..perhaps for a rootkit…in this case an assembly C  inline only to access specific CPU registers…but only small chunks.

eventually in this case   when You use *itertools*'s  methods  for simple or complex iteration, speed will not be a your problem…make your tests guy ;D
Thanks to all!

4
Scripting Languages / Re: Python Port of Word List Generator
« on: October 09, 2013, 12:19:19 PM »
The code to me looks clean. However python itself is not really good with such computations so I would blame python for being slow.


Mr. Admin  Kulverstukas
ok You deleted my last post, because does not have a pleasing my comment on your post..(is this  your rules of behavior  for *create a forum worthy of being visited?????*...MEMBERS I LEAVE YOU A RESPONSE...)...
congratulations but  this isn't  the way!!!
comparison between people..that's the way.


Eventually it's ok no problem, but Please deleted also your post because you do not know what you're talking...and GIVE  INCORRECT INFORMATION;
 otherwise You have to justify what You said...we are waiting
ps. sorry to all for my bad english...uhhhh  ;)


Regards


madara

5
Scripting Languages / Re: Python Port of Word List Generator
« on: October 08, 2013, 11:35:33 PM »
Python is Python because isn't  php or  java....Please..


Code: [Select]
#Python3


def product(*args, **karg):
    pools    = list(map(tuple, args)) * karg.get('repeat', 1) #list because in Python3 map return a gen.
    acc      = [[]]
    for pool in pools:
        acc  = (x+[y] for x in acc for y in pool) #generator expr.  save memory
    for prod in acc:
        yield tuple(prod)


for x in product(['a', 'b', 'c'], repeat=5):
    print(''.join(x))





or simply use plug and play *product* iterator from *itertools*; look at official documentation

6
Other / Re: [Python, Scala, Java] Wordgenerator (bruteforce snippets)
« on: June 26, 2013, 07:12:42 PM »
HI Deque..
very good tutorial on generators behavior in different languages...!!
the next step in Python is to take advantage of its 'powerful' core library:
in fact  we can achieve the same goal  faster with itertools' combinatoric generators:

Code: [Select]

from itertools import product
dictionary = ['a','b','c','d','e','f','g']
pass_gen = product(dictionary, repeat = 3) #pass_gen return a generator;
                                                              # with repeat we can set  word width
for pwd in pass_gen:
   print("".join(pwd))




Thanks for good tutorial ;) 



7
Code: (python) [Select]
def calculateSize(self, bytes):
    abbrevs = ["kB", "mB", "gB"]
    if (bytes == None):
        size = "0 kB"
    else:
        bytes = float(bytes)
        for abbrev in abbrevs:
            if (bytes > 1024.0):
                bytes = bytes / 1024.0
                size = "%.2f %s" % (bytes, abbrev)
    return size



ok can be good, but now we can rewrite it in python:


Code: (python) [Select]

import math
def byteszConverter(bytes=1):
    abbrevs = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
    esp = math.floor(math.log(bytes)/math.log(1024))
    return '{0:.2f}'.format(bytes/math.pow(1024, esp)) + ' ' + abbrevs[esp]
Python 2.x users  need simple changes...

8
Scripting Languages / Re: [Python] Tic Tac Toe
« on: May 25, 2013, 05:21:43 PM »
as first script wow! :)

some little advice for less redundancy in code : list is mutable object -->
then , within functions,  You can avoid (but in Python: You must!! ;D) declare it as global ;

hereafter You'll  'update' it  in a pythonic  OOP  way ;)

Pages: [1]


Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.