#TUDO É OBJETO
puts 1.class # => Fixnun
puts "123".class # => String
puts false.class # => FalseClass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias l='clear; ls -lF' | |
alias ll='clear; ls -alF' | |
alias h=history | |
alias python=python3 | |
### Short prompt | |
alias p='PS1="\${debian_chroot:+(\$debian_chroot)}\e[1;34m/\W\e[00m\[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "; clear' | |
# Git |
# views.py
def books_list(self):
books_name = {}
total = 0
for item in Author.objects.all().order_by('books__name'):
first_book = item.books.first()
if first_book:
total += 1
books_name[first_book] = books_name.get(first_book, 0) + 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# post-receive hook for git-based deployments | |
# https://edmondburnett.com/post/python-push-to-deploy | |
import sys | |
import os | |
from subprocess import call | |
# configuration | |
deploy_to_path = '/path/to/deploy/directory/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' Exporta planilhas em Excel ''' | |
from datetime import datetime | |
import django_excel as excel | |
from django.http import HttpResponseBadRequest | |
from .models import Person | |
MDATA = datetime.now().strftime('%Y-%m-%d') | |
def export_data_person(request, atype): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Colors | |
red=`tput setaf 1` | |
green=`tput setaf 2` | |
reset=`tput sgr0` | |
sudo apt-get install graphviz libgraphviz-dev pkg-config | |
pip install pygraphviz | |
git clone https://github.com/nlhepler/pydot | |
cd pydot | |
python setup.py install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
sudo apt-get install -y git make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
sudo vim ~/.bashrc
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"