Skip to content

Instantly share code, notes, and snippets.

View viniciusban's full-sized avatar

Vinicius Assef viniciusban

  • Rio de Janeiro, Brazil
View GitHub Profile
@viniciusban
viniciusban / hierarquia_models.py
Last active July 19, 2023 10:30
Django - Hierarquia de models
class VinculoGeral(models.Model):
'''Essa classe será criada pelo Django.
Ela não tem nenhuma validação.
'''
tipo_vinculo = models.ForeignKey('TipoVinculoProfissional')
profissional = models.ForeignKey('Profissional')
data_inicio = models.DateField()
data_fim = models.DateField()
@viniciusban
viniciusban / good-commit-messages.md
Last active April 7, 2023 03:15
Good commit messages
@viniciusban
viniciusban / 00-detect-current-venv.py
Last active July 12, 2021 11:13 — forked from henriquebastos/00-detect-virtualenv-sitepackages.py
IPython startup script to detect and inject VIRTUAL_ENV's site-packages dirs.
"""IPython startup script to detect and inject VIRTUAL_ENV's site-packages dirs.
IPython can detect virtualenv's path and injects it's site-packages dirs into sys.path.
But it can go wrong if IPython's python version differs from VIRTUAL_ENV's.
This module fixes it looking for the actual directories. We use only old stdlib
resources so it can work with as many Python versions as possible.
References:
http://stackoverflow.com/a/30650831/443564

Keybase proof

I hereby claim:

  • I am viniciusban on github.
  • I am viniciusban (https://keybase.io/viniciusban) on keybase.
  • I have a public key ASAVZBinTkSjynTnLZOBiJriADJUiQWgFKQwon3jtGeuoAo

To claim this, I am signing this object:

@viniciusban
viniciusban / functions.py
Created January 19, 2021 19:43
Checking arguments of called mocked objects
# functions.py
class CustomPessoa:
def __init__(self, *args, **kwargs):
for (k, v) in kwargs.items():
setattr(self, k, v)
def target_function(pessoa, outro_arg):
@viniciusban
viniciusban / new_user.txt
Last active May 22, 2020 15:40
new user credentials
john:hey,Iamjohn.:John Doe
@viniciusban
viniciusban / grok_vi.mdown
Created November 21, 2019 16:42 — forked from nifl/grok_vi.mdown
Your problem with Vim is that you don't grok vi.

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@viniciusban
viniciusban / activate-shared-folder-and-clipboard-in-linux-guest.md
Last active July 7, 2019 02:07
Activate shared folders in Linux guest (VirtualBox)

For Elementary OS 18.04 guest under MacOS host.

Step 1: install Guest Additions

Open terminal inside the VM and type:

$ sudo apt -y update
$ sudo apt -y upgrade

$ sudo apt -y install dkms build-essential

@viniciusban
viniciusban / python-code-style.md
Last active June 20, 2019 16:14
Python coding style

Coding style

Follow these rules below.

General style

Follow PEP 8.

As a summary: