Manually installing PIL

2007-01-07 Thread Ghirai
Hello,

My host doesn't have PIL installed, and from
what i can tell, they won't install it.

Is there any way i can copy the needed files
near my python script?

I'm using Image, ImageFont, ImageDraw and ImageFilter.

Thanks.

-- 
Best regards,
Ghirai.

-- 
http://mail.python.org/mailman/listinfo/python-list


Drawing a graph

2007-08-13 Thread Ghirai
Hello list,

I need to draw a graph, 2 axes, 2D, nothing fancy.
One of the axes is time, the other one is a series of integers.

I don't care much about the output format.

Are there any specialized libraries for this, or should i use PIL?

Thanks.

-- 
Regards,
Ghirai.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Drawing a graph

2007-08-13 Thread Ghirai
I ended up using matplotlib (http://matplotlib.sourceforge.net).

Thanks for the input everyone.

-- 
Regards,
Ghirai.
-- 
http://mail.python.org/mailman/listinfo/python-list


curses library

2007-08-14 Thread Ghirai
Hello list,

I need to write a console application.

Are there any wrappers around curses/ncurses?
Or any other similar libraries?

Thanks.
-- 
Regards,
Ghirai.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: curses library

2007-08-14 Thread Ghirai
On Tue, 14 Aug 2007 18:27:16 GMT
Neil Cerutti <[EMAIL PROTECTED]> wrote:

> On 2007-08-14, Ghirai <[EMAIL PROTECTED]> wrote:
> > I need to write a console application.
> >
> > Are there any wrappers around curses/ncurses?
> > Or any other similar libraries?
> 
> The answer depends on your chosen platform. Python hasn't got a
> cross-platform console library as one of its included batteries.
> 
> First try the curses module. It does come with Python on systems
> with a curses port.
> 
> For Windows, there's the Effbot's console module.
> http://effbot.org/zone/console-index.htm
> 
> Or go to plan B: Use a Tkinter or other GUI interface's text
> widget.

Forgot to say, i don't need it to work on windows :)

-- 
Regards,
Ghirai.
-- 
http://mail.python.org/mailman/listinfo/python-list


IDE for wxPython

2007-03-17 Thread Ghirai
Hello python-list,

Can anyone suggest an IDE for wxPython?
Or an IDE for TkInter?

Thanks.

-- 
Best regards,
Ghirai.

-- 
http://mail.python.org/mailman/listinfo/python-list


p2p chat framework

2007-04-02 Thread Ghirai
Hello python-list,

Are there any p2p chat/filetransfer frameworks/examples floating
around?

If not, can someone give me some rough directions towards writing my
own?

Thanks.

-- 
Best regards,
Ghirai.

-- 
http://mail.python.org/mailman/listinfo/python-list


p2p chat framework

2007-04-03 Thread Ghirai
Hello python-list,

Are there any p2p chat/filetransfer frameworks/examples floating
around?

If not, can someone give me some rough directions towards writing my
own?

Thanks.

-- 
Best regards,
Ghirai.

-- 
http://mail.python.org/mailman/listinfo/python-list


Login Form

2007-01-19 Thread Ghirai
Hello python-list,

I need to make a login form, if possible without cookies.
Can anyone point me in the right direction? Or are there any
examples?

Thanks.

-- 
Best regards,
Ghirai.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] minimalist web server

2007-12-02 Thread ghirai

> On Dec 1, 2007 7:02 PM, Daniel Fetchinson <[EMAIL PROTECTED]> wrote:
>> > > I'm looking for the most minimalist web server ever that does nothing
>> > > else than return a fixed static page for every request. Regardless of
>> > > what the request is, it just needs to be an HTTP request to port 80,
>> > > the web server should return always the same html document. What would
>> > > be the best choice for this? The goal is of course to minimize system
>> > > resources in terms of memory, cpu, etc, etc.
>> >
>> > If you're running linux, maybe you want tux.
>> >
>> > publicfile isn't exactly what you describe, but its description might
>> > be of some interest:
>> >
>> > http://cr.yp.to/publicfile.html
>>
>>
>> Thanks, tux looks good, the only problem is that one needs to
>> recompile the kernel which I really don't want to do (so yes, I'm on
>> linux). Publicfile seems to "know" already too much.
>>
>> The reason I need this is that my current best strategy to avoid ads
>> in web pages is putting all ad server names into /etc/hosts and stick
>> my local ip number next to them (127.0.0.1) so every ad request goes
>> to my machine. I run apache which has an empty page for 404 errors so
>> I'll just see that blank page for every ad. Now I guess apache is a
>> pretty heavy weight guy so I'm looking for a lightweight alternative.
>> Lighttpd, nginx and company are all too complex and "know" too much. I
>> even considered just putting netcat into an infinite loop but I'm
>> afraid if there is a security hole in netcat I might be screwed.
>>
>> Maybe now that I outlined a little more why I need this others can
>> come up with more suggestions.
>>

Running this will start a server on port 80 which will serve files in  
the current folder:

import SimpleHTTPServer
import SocketServer
SocketServer.TCPServer(("",80),SimpleHTTPServer.SimpleHTTPRequestHandler).serve_forever()


Regards,
Ghirai.

-- 
http://mail.python.org/mailman/listinfo/python-list


monitoring/restarting an application

2009-03-05 Thread Ghirai
Hello list,

I need to keep x number of instances of an external applications
running, say /bin/x, but also kill and restart each one after y seconds.

What would be the best way to do this (with python 2.5.x)?

I'm thinking of having a list of running pids, then have a thread check
if len(list) < x, and if it is, then start a new process (with
os.spawnv?) and add it to the list.
Also in the list i'd keep PIDs and some sort of started-timestamp, so i
know which to kill.

Does this sound reasonable, or is there an easier way?

Thanks.

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list


Re: monitoring/restarting an application

2009-03-05 Thread Ghirai
On 05 Mar 2009 07:44:44 -0800
Paul Rubin <http://phr...@nospam.invalid> wrote:

> Ghirai  writes:
> > Does this sound reasonable, or is there an easier way?
> 
> Use something like daemontools or upstart.  Don't roll your own.
> --

Alright, i'll have a look at those as well as supervisor.
Thanks.

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: Keep TCP socket open

2008-05-19 Thread Ghirai
On Mon, 19 May 2008 20:25:57 +0100
"Alan Wright" <[EMAIL PROTECTED]> wrote:

> Thanks for the feedback.
> 
> Using the socket in a list is great
> 
> However, as i imagined, I now get a limit of around 1500 conns before
> the system crashes out, also i have noticed, that the ports loop back
> to 1025 when they hit 5000.
> 
> Any ideas on how to make the list/socket get to around 50K
> 
> TIA
> 

Try to use scapy to send raw empty packets with S flag set.
Also use Linux/BSD if you're trying this on Windows.

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: Keep TCP socket open

2008-05-19 Thread Ghirai
On Mon, 19 May 2008 23:50:50 +0100
"Alan Wright" <[EMAIL PROTECTED]> wrote:

> Ghirai,
> Scapy does the same, only it sends RST and not FIN, so still no help
> 
>  send(IP(dst="10.1.1.2")/TCP(dport=5,flags="S"))
> 
> Only have windows at the moment sadly.
> 
> Alan
> 

Are you sure there's no firewall or something else between you and the
remote host?

Because i just tried that command with scapy and it didn't send any other 
packets
except what it was told (1 packet with SYN flag set).

I haven't tried on windows though.

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list


urllib getting SSL certificate info

2008-08-16 Thread Ghirai
Hello list,

Using urllib, is there any way i could access some info about the SSL 
certificate (when opening a https url)?

I'm really interested in the fingerprint.

I haven't been able to find anything so far.

Any help is appreciated.

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib getting SSL certificate info

2008-08-16 Thread Ghirai
On Saturday 16 August 2008 12:16:14 Fredrik Lundh wrote:
> Ghirai wrote:
> > Using urllib, is there any way i could access some info about the SSL
> > certificate (when opening a https url)?
> >
> > I'm really interested in the fingerprint.
> >
> > I haven't been able to find anything so far.
>
> you can get some info via (undocumented?) attributes on the file handle:
>  >>> import urllib
>  >>> f = urllib.urlopen("https://mail.google.com/";)
>  >>> f.fp
>
> 
> ['issuer', 'read', 'server', 'write']
>
>  >>> f.fp._ssl.issuer()
>
> '/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA'
>
>  >>> f.fp._ssl.server()
>
> '/C=US/ST=California/L=Mountain View/O=Google Inc/CN=mail.google.com'
>
> 
>
> --
> http://mail.python.org/mailman/listinfo/python-list


Thanks, that seems to be getting me very close of what i need.

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib getting SSL certificate info

2008-08-19 Thread Ghirai
On Sunday 17 August 2008 20:15:47 John Nagle wrote:

> If you really need details from the SSL cert, you usually have to use
> M2Crypto.  The base SSL package doesn't actually do much with certificates.
> It doesn't validate the certificate chain.  And those strings of
> attributes you can get are ambiguious; data fields may contain unescaped
> "/", which is the field separator.  I went through this last year and
> had to use M2Crypto, which is something of a headache but more or less
> works.
>
>   John Nagle

Would you mind sharing some code? The module is pretty ugly and on top has no 
docs whatsoever; got tired of reading the source...

Thanks.

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib getting SSL certificate info

2008-08-19 Thread Ghirai
On Wednesday 20 August 2008 00:05:47 Jean-Paul Calderone wrote:

> I don't know about M2Crypto.  Here's some sample code for PyOpenSSL:
>
>   from socket import socket
>   from OpenSSL.SSL import Connection, Context, SSLv3_METHOD
>   s = socket()
>   s.connect(('google.com', 443))
>   c = Connection(Context(SSLv3_METHOD), s)
>   c.set_connect_state()
>   c.send('GET / HTTP/1.1\r\n\r\n')
>   cert = c.get_peer_certificate()
>   print cert.get_issuer().get_components()
>   print cert.get_subject().get_components()
>
> When I run this, I get:
>
>   [('C', 'ZA'), ('O', 'Thawte Consulting (Pty) Ltd.'), ('CN', 'Thawte SGC
> CA')] [('C', 'US'), ('ST', 'California'), ('L', 'Mountain View'), ('O',
> 'Google Inc'), ('CN', 'www.google.com')]
>
>

Thanks, i'll go with PyOpenSSL, it seems easier, and has decent docs :)

-- 
Regards,
Ghirai.
--
http://mail.python.org/mailman/listinfo/python-list