Skip to content

Instantly share code, notes, and snippets.

View dhelbegor's full-sized avatar
🤘
Awesome

Adailton Nascimento dhelbegor

🤘
Awesome
View GitHub Profile
## utils.py
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
def get_paginator(qs, page_size, page, count, paginated_type, **kwargs):
"""
Method to paginate with some basics parameters in the query.
@page: get current page
@pages: show total of pages
@count: show the total of items in the query
@page_size: the page size param
@dhelbegor
dhelbegor / .bashrc
Last active August 21, 2020 01:36
creating projects with boilerplates with command line.
# // Init personal configs
# adding alias for decreases path virtualenv and exit the project
alias er='source .venv/bin/activate; PS1="(`basename \"$VIRTUAL_ENV\"`):/\W$ "'
alias deac='deactivate'
# Start virtualenvs
function Envs(){
# used to create virtualenvs
alias wait_env='echo wait creating the env... && sleep 2 && clear'
alias done_env='echo done! && sleep 2 && clear'
@dhelbegor
dhelbegor / Control_Base.py
Last active July 29, 2022 03:52
Sistema simples para cadastro de produtos, incluindo cadastro de usuarios!!!
# -*- coding:UTF-8 -*-
from ttk import *
from Tkinter import *
import tkMessageBox
import sqlite3
import ttk
import os
raiz=Tk()
def dic_bd(bd, tabela):