Skip to content

Instantly share code, notes, and snippets.

View oiacrasec's full-sized avatar

Caio César Lima Borges oiacrasec

  • Datasync
  • Goiânia - GO
View GitHub Profile
@julianwachholz
julianwachholz / fields.py
Created September 26, 2013 19:21
Easy single `<input>` month/year form field for Django.
class CreditCardExpirationField(forms.DateField):
default_error_messages = {
'min_value': _("This card has expired."),
'invalid': _("Please specify a valid expiration date.")
}
widget = forms.DateInput(format='%m/%Y')
input_formats = ('%m/%Y', '%m/%y')
default_validators = [
MinValueValidator(now().date()),
]
@sheikhwaqas
sheikhwaqas / setup-mongodb34-ubuntu16.sh
Last active September 17, 2020 09:55
Install mongoDB 3.4 on Ubuntu 16.04 LTS
###############################################################################
# Install mongoDB Server on Ubuntu 16.04 LTS
###############################################################################
# Import the Public Key used by the Ubuntu Package Manager
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
# Create a file list for mongoDB to fetch the current repository
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
@rafaelreuber
rafaelreuber / boleto.py
Created April 23, 2019 03:19
Geração de boleto usando python-boleto
def gerar_itau(fatura, bank, encargos=0):
invoice = BoletoItau()
invoice.data_vencimento = fatura.dtvencto.date()
invoice.data_documento = fatura.dtemissao
invoice.nosso_numero = fatura.nosso_numero
invoice.numero_documento = fatura.fatura
invoice.valor_documento = fatura.valor
empresa = Empresa.objects.get(pk=settings.STUR_EMPRESA)