Skip to content

Instantly share code, notes, and snippets.

View icorradi's full-sized avatar

Igor Corradi icorradi

View GitHub Profile
@antoniopresto
antoniopresto / banco_codigo.json
Last active March 1, 2024 13:11
JSON bancos do brasil com código
[
{
"value": "001",
"label": "Banco do Brasil S.A."
},
{
"value": "003",
"label": "Banco da Amazônia S.A."
},
{
@lucascnr
lucascnr / cpf_cnpj_generator.py
Created November 18, 2016 19:36
Gerador de CPF e CNPJ em Python
def generate_cpf(self):
cpf = [random.randint(0, 9) for x in range(9)]
for _ in range(2):
val = sum([(len(cpf) + 1 - i) * v for i, v in enumerate(cpf)]) % 11
cpf.append(11 - val if val > 1 else 0)
return '%s%s%s.%s%s%s.%s%s%s-%s%s' % tuple(cpf)
@apolloclark
apolloclark / postgres cheatsheet.md
Last active March 7, 2024 13:53
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@ryansechrest
ryansechrest / php-style-guide.md
Last active April 21, 2024 18:50
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@yprez
yprez / fields.py
Last active February 19, 2023 12:08
Django rest framework - Base64 image field
import base64
from django.core.files.base import ContentFile
from rest_framework import serializers
class Base64ImageField(serializers.ImageField):
def from_native(self, data):
if isinstance(data, basestring) and data.startswith('data:image'):
# base64 encoded image - decode