Skip to content

Instantly share code, notes, and snippets.

View horacioibrahim's full-sized avatar

Horacio Ibrahim horacioibrahim

View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Adrien Pujol - http://www.crashdump.fr/"
__copyright__ = "Copyright 2013, Adrien Pujol"
__license__ = "Mozilla Public License"
__version__ = "0.3"
__email__ = "adrien.pujol@crashdump.fr"
__status__ = "Development"
__doc__ = "Check a TLS certificate validity."
Thu Mar 20 17:24:00.676 [conn17] build index forum.newcolOne { _id: 1 }
Thu Mar 20 17:24:00.677 [conn17] build index done. scanned 0 total records. 0 secs
Thu Mar 20 17:24:12.144 [conn17] build index forum.newcolTwo { _id: 1 }
Thu Mar 20 17:24:12.195 [conn17] build index done. scanned 0 total records. 0.051 secs
Thu Mar 20 17:24:31.321 [conn17] build index forum.newcolThree { _id: 1 }
Thu Mar 20 17:24:31.409 [conn17] build index done. scanned 0 total records. 0.087 secs
Thu Mar 20 17:24:43.095 [conn17] build index forum.newcolFour { _id: 1 }
Thu Mar 20 17:33:12.076 [conn17] build index forum.newcolFive { _id: 1 }
Thu Mar 20 17:33:12.114 [conn17] build index done. scanned 0 total records. 0.037 secs
@horacioibrahim
horacioibrahim / test_payload_no_webmongo
Created March 28, 2014 00:03
This file contains a small code to check if the limit of 40MB of queries is exclusive of Websrv Mongo. The question was raise in http://stackoverflow.com/questions/22646510/
__author__ = 'horacioibrahim'
# This file contains a small code to check if the limit of 40MB returned by
# Websrv Mongo it's really exclusive where called OP_KILL_CURSORS
# All indicates and a little obvious that result to be returned all documents
# via cursor, BUT we have to run.
# The tests are applicable to mongoDB.
#
# Requirements: bottle and pymongo
#
@horacioibrahim
horacioibrahim / docgo.py
Last active August 29, 2015 14:06
docgo - para traduzir certos pydoc's
# -*- coding: UTF-8 -*-#
#
# Isto é um fragmento de código para traduzir certos pydoc's
# que usa o goslate de https://pypi.python.org/pypi/goslate
# LEMBRE: que o Google Tradutor faz traduções literais que
# às vezes pode não fazer sentido. Assim você que dará sentido
# ao texto traduzido conforme o contexto.
#
# Foi criado para o curso Python X-Series (101x). Por isso é
# interesse que você não copie este código. Assim, abra um
@horacioibrahim
horacioibrahim / goods
Created September 28, 2014 20:30
Desafio dos tipos básicos.
# -*- coding: UTF-8 -*-
"""
Minha lista de compras. O gabarito dos testes
Python 101x - Interleaving practices.
Criado por: horacioibrahim at gmail dot com
"""
# Baixe o arquivo CSV http://pastebin.com/jMaxUr0p
# ou copie os valores (RAW Paste Data) abra um arquivo
# de texto simples e salve. Exemplo:
@horacioibrahim
horacioibrahim / copy_dict.py
Last active August 29, 2015 14:07
Handling a dict in our class
"""
Simple code for to show when is need to use copy()
"""
class MyObj(object):
# ... hide ...
def save(self, document, id_field="_id"):
"""
@horacioibrahim
horacioibrahim / home.html
Last active August 29, 2015 14:27
dom-bind instead variable of template (Jinja2)
<!-- ... omitted ... -->
<body>
<!--
In this case, I have passed variable of template in the attributes of the element sc-navbar.
NOTE: I did change of '{{' to '%%' for display the variables from Flask template engine. This help us
to see difference of the Flask for Polymer scopes.
I'm using g (global variable) of the Flask (see more: http://flask.pocoo.org/docs/0.10/templating/#standard-context)
-->
<sc-navbar username="%% g.user.shortname %%" avatar="%% g.user.md5_email %%" online="%% g.user.status_online %%"></sc-navbar>
</body>
@horacioibrahim
horacioibrahim / schema_org.py
Created October 14, 2015 17:05 — forked from redapple/schema_org.py
schema.org with XPath blog post
from scrapy.selector import Selector
selector = Selector(text="""
<div itemscope itemtype ="http://schema.org/Movie">
<h1 itemprop="name">Avatar</h1>
<span>Director: <span itemprop="director">James Cameron</span> (born August 16, 1954)</span>
<span itemprop="genre">Science fiction</span>
<a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">Trailer</a>
</div>""", type="html")