Skip to content

Instantly share code, notes, and snippets.

View CleitonDeLima's full-sized avatar
🇧🇷
Working from home

Cleiton de Lima CleitonDeLima

🇧🇷
Working from home
View GitHub Profile
# models.py
class State(models.Model):
name = models.CharField(_('nome'), max_length=60)
class Meta:
verbose_name = _('estado')
verbose_name_plural = _('estados')
def __str__(self):
The SSL certificate used to load resources from https://amplifypixel.outbrain.com will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.
merged-game-b4a922c3.js:19 [Deprecation] GainNode.gain.value setter smoothing is deprecated and will be removed in M64, around January 2018. Please use setTargetAtTime() instead if smoothing is needed. See https://www.chromestatus.com/features/5287995770929152 for more details.
[Deprecation] AudioParam value setter will become equivalent to AudioParam.setValueAtTime() in M65, around March 2018 See https://webaudio.github.io/web-audio-api/#dom-audioparam-value for more details.
@CleitonDeLima
CleitonDeLima / select2-vuejs-component.md
Created March 13, 2018 13:39 — forked from craigh411/select2-vuejs-component.md
Vue.js component for Select2

#Vue.js component for Select2

A select2 component for vue.js. Quickly create select2 components, load data via ajax and retrieve selected values and newly created tags.

#Usage

Download and register the component:

Vue.component(
CONSUMER_KEY=
CONSUMER_SECRET=
ACCESS_TOKEN=
ACCESS_SECRET=
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
def receive():
while True:
try:
msg = client_socket.recv(BUFFSIZE).decode("utf8")
print(msg)
except OSError:
def draw_text(self, text, x, y, text_width=80):
self.canvas.saveState()
text_lines = textwrap.fill(text, text_width).split('\n')
text = self.canvas.beginText(x, y)
for t in text_lines:
text.textLine(t)
self.canvas.drawText(text)
self.canvas.restoreState()
@CleitonDeLima
CleitonDeLima / django-media-permissions.md
Created March 6, 2019 20:05 — forked from douglasmiranda/django-media-permissions.md
Fix Django Media Folder Permissions

Check your current file/directory permission with:

stat -c "%a" /path/to/dir_or_file

To recursively give directories read&execute privileges:

find /path/to/base/dir -type d -exec chmod 755 {} +
@CleitonDeLima
CleitonDeLima / install-docker.sh
Last active October 15, 2019 13:37 — forked from sethbergman/install-docker.sh
Install Docker CE on Linux Mint 19
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
# use linux mint: sudo add-apt-repository "\ndeb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install docker.io
@CleitonDeLima
CleitonDeLima / things.txt
Created January 28, 2020 03:09
Install dependencies SO
# install deps
sudo apt install vim zsh tree postgresql redis-server redis curl wget git terminator xmlsec1 make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
# oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# pyenv
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper
from django.forms import BaseInlineFormSet, Media
class BaseInlineNestedFormSet(BaseInlineFormSet):
"""
Classe usada para criar formsets aninhados
Example:
class NestedFormSet(BaseInlineNestedFormSet):
nesteds = {
"prefix": FormSet,