• Diogo Mónica


    Por diogomonica, em 20 Dezembro 2015 03:00 - Mais entradas deste utilizador
  • Diogo Mónica

    Diogo Mónica - Security Lead @Docker

    Por diogomonica, em 20 Dezembro 2015 03:00 - Mais entradas deste utilizador
    Welcome to Diogo Mónica's Website (Security Lead @Docker)
  • Diogo Mónica


    Por diogomonica, em 20 Dezembro 2015 03:00 - Mais entradas deste utilizador
  • Diogo Mónica


    Por diogomonica, em 20 Dezembro 2015 03:00 - Mais entradas deste utilizador
  • Goncalo Gomes

    quick reference for http codes in python

    Por goncalogomes, em 8 Agosto 2015 18:05 - Mais entradas deste utilizador

    Just came across this while browsing the SimpleHTTPServer code from the standard lib in Python 2.7 and as I’m a sucker for lists of codes and their inherent meanings, I figured I’d post it here (see also signals)

    from BaseHTTPServer import BaseHTTPRequestHandler
    for code, meaning in BaseHTTPRequestHandler.responses.items():
        print code, "=>", meaning[0]


    200 => OK
    201 => Created
    202 => Accepted
    203 => Non-Authoritative Information
    204 => No Content
    205 => Reset Content
    206 => Partial Content
    400 => Bad Request
    401 => Unauthorized
    402 => Payment Required
    403 => Forbidden
    404 => Not Found
    405 => Method Not Allowed
    406 => Not Acceptable
    407 => Proxy Authentication Required
    408 => Request Timeout
    409 => Conflict
    410 => Gone
    411 => Length Required
    412 => Precondition Failed
    413 => Request Entity Too Large
    414 => Request-URI Too Long
    415 => Unsupported Media Type
    416 => Requested Range Not Satisfiable
    417 => Expectation Failed
    100 => Continue
    101 => Switching Protocols
    300 => Multiple Choices
    301 => Moved Permanently
    302 => Found
    303 => See Other
    304 => Not Modified
    305 => Use Proxy
    307 => Temporary Redirect
    500 => Internal Server Error
    501 => Not Implemented
    502 => Bad Gateway
    503 => Service Unavailable
    504 => Gateway Timeout
    505 => HTTP Version Not Supported

  • Goncalo Gomes

    cloning all github repositories

    Por goncalogomes, em 16 Julho 2015 23:52 - Mais entradas deste utilizador

    I was searching the web for a quick way to clone all of the XenServer repositories on github with little effort and came across this snippet on GIST by caniszczyk:

    curl -s | ruby -rubygems -e 'require "json"; JSON.load( { |repo| %x[git clone #{repo["ssh_url"]} ]}'

    It worked neatly. Although, the sequential nature of the git-clone loop caused it to take a considerable amount of time to complete. This prompted me to think about how could I parallelize the git-clone and re-write it as a python oneliner instead, so my version of the script above, as translated to curl/python/xargs can be found below. The xargs -P command is used to control how many parallel processes are spawned, adjust according to your bandwidth/computer.

    curl -s | python -c 'import sys,json; print "\n".join(map(lambda x: x.get("ssh_url"), json.loads(' |xargs -L1 -P 10 git clone
  • Diogo Mónica

    Diogo Mónica - Platform Security Lead @Square

    Por diogomonica, em 2 Março 2015 05:00 - Mais entradas deste utilizador
    Welcome to Diogo Mónica's Personal Website
  • Alcides Fonseca

    Farewell passenger!

    Por alcides, em 19 Fevereiro 2015 10:07 - Mais entradas deste utilizador

    6 years later and two VPS later, I decided it was time to leave Phusion Passenger.

    I was experience several downtimes due to database (both mariadb and mysql) crashes. It turns out the database could not recover because ruby was occupying the whole memory (512Mb on DigitalOcean). The solution was to shut down apache, then start the database, and finally start apache again. But this would only work for a couple of days.

    I decided to move all my django sites to WSGI (yes, I was deploying django apps using passenger) and ported a sinatra app to django (thanks to legacy database support) just so I could get rid of ruby.

    It all works well now. But in the meanwhile, I went to read Passenger’s source code and I am currently considering forking and removing everything ruby from it. Just an apache2 module that would automatically handle wsgi, avoiding 4 lines of apache config per project. It can be done, I am just not sure it is worth the time. Maybe it would help other people with plain-simple deploying on Apache/NGINX?

  • OCRFeeder 0.8.1

    Por jrocha, em 22 Dezembro 2014 08:38 - Mais entradas deste utilizador

    Taking advantage of the holidays, I have been dedicating some time to my side projects so today I am giving you OCRFeeder version 0.8.1!

    The last OCRFeeder version had a very important change which was the port to GObject introspection and I was already expecting a few bugs to pop up here and there. That proved to be true and so this version is mainly about bug fixing.
    Specifically there was an issue related to GDK’s threads which caused the application to abort. Besides that, exporting a document or saving/loading a project was not working correctly due to unicode issues (because Python is very nice but working with unicode is sometimes more annoying than it should be, at least in versions prior to Python 3).
    Anyway, all that should be working correctly now!

    Besides squashing bugs, I also made some long due changes: made the Preferences dialog smaller (by adding its contents to a scrolled window) and migrated the application and engines’ settings to the XDG user configuration folder as opposed to .ocrfeeder.
    Yes, I know that I should be using GSettings for the application’s settings by now but there were more critical changes to be done.
    Besides a small change in the widgets that set a box’s type (from a radio button style to a non-indicator, grouped pair of buttons), there are no other UI changes but I really like how much more polished OCRFeeder seems with the nice recent GTK+ styles.



    I have a number of ideas to make the application better not only in terms of UI/UX but also in terms of features. The detection algorithm hasn’t been touched for years and I am sure it can be improved not only in terms of performance but also in terms of accuracy.
    One cool feature I’d love to see implemented is to have a quick way of translating a document’s contents. This would be helpful e.g. to users living abroad who might need to translate letters to a language they speak.
    Nonetheless, as mentioned in my previous post about OCRFeeder, it is indeed not easy to find the time and motivation to dedicate to the project these days with all the work, life and other side projects so I don’t know when I will have time for it again. In that regard, if you want to give me a hand, you’d make me very happy as there is a lot of work to be done.

    Happy holidays everyone!

    Source tarball