Skip to content

Instantly share code, notes, and snippets.

View horacioibrahim's full-sized avatar

Horacio Ibrahim horacioibrahim

View GitHub Profile
function load() {
app = document.querySelector('sc-app');
a =[ {"label": "Decorrido do prazo" , "value": 120, "unit": "minutos"}, {"label": "Decorrido do prazo" , "value": 310, "unit": "minutos"}, {"label": "Decorrido do prazo" , "value": 150, "unit": "minutos"}, {"label": "GSTIDFCOC" , "value": 50, "unit": "minutos"},
{"label": "Tempo restante", "value": 230, "unit": "minutos"}];
b =[ {"label": "Decorrido do prazo" , "value": 30, "unit": "minutos"},
{"label": "Tempo restante", "value": 70, "unit": "minutos"}];
app.$.termobar.data = a;
}
@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 / 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
@redapple
redapple / schema_org.py
Created June 19, 2014 09:05
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")
@katowulf
katowulf / 1_query_timestamp.js
Last active September 21, 2023 20:28
Get only new items from Firebase
// assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP)
// pros: fast and done server-side (less bandwidth, faster response), simple
// cons: a few bytes on each record for the timestamp
var ref = new Firebase(...);
ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) {
console.log('new record', snap.key());
});
@crashdump
crashdump / check-ssl-expire.py
Last active January 9, 2023 09:45
Report how many days before and http ssl certificate expire. I've also provided a template if you want to use it with Zabbix as an External Check: - Configure ExternalScripts variable in zabbix_server.conf - Put the script in the external script folder (I've used /etc/zabbix/externalscripts/) - Import the template & assign it to your host. - Wat…
#!/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."
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',