This file contains 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 node | |
// todo: try to require jshint here, instead of spawning process, then fallback to spawning process. | |
var jshint = nrequire('jshint'); | |
if (jshint) return process.exit(0); | |
// jshint not installed locally, spawn process instead. | |
// basically the same, but less pretty. | |
var exec = require('child_process').exec; |
This file contains 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
{ | |
"estados": [ | |
{ | |
"sigla": "AC", | |
"nome": "Acre", | |
"cidades": [ | |
"Acrelândia", | |
"Assis Brasil", | |
"Brasiléia", | |
"Bujari", |
This file contains 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
from django.core.files.uploadhandler import TemporaryFileUploadHandler | |
from django.core.files.base import File | |
from dropbox.client import DropboxClient | |
from dropbox.session import DropboxSession | |
from django.conf import settings | |
import os | |
class DropboxFileUploadHandler(TemporaryFileUploadHandler): | |
def __init__(self, *args, **kwargs): | |
super(DropboxFileUploadHandler, self).__init__(*args, **kwargs) |
This file contains 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
Para CPF | |
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/ | |
Para CNPJ | |
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/ | |
Para ambos ao mesmo tempo |
This file contains 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
try: | |
from django.apps import apps | |
get_model = apps.get_model | |
except ImportError: | |
from django.db.models.loading import get_model |
This file contains 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
.PHONY: clean-pyc clean-build docs clean | |
define BROWSER_PYSCRIPT | |
import os, webbrowser, sys | |
try: | |
from urllib import pathname2url | |
except: | |
from urllib.request import pathname2url | |
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) | |
endef |
This file contains 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
Docs - LXD Helpful Docs: | |
https://www.stgraber.org/2016/03/30/lxd-2-0-image-management-512/ | |
https://www.flockport.com/flockport-first-look-at-lxd/ | |
http://insights.ubuntu.com/2016/03/14/the-lxd-2-0-story-prologue/ | |
Docs - Installation: | |
http://insights.ubuntu.com/2016/03/14/the-lxd-2-0-story-prologue/ | |
Docs - API: | |
https://linuxcontainers.org/lxd/getting-started-cli/ |
This file contains 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
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v2.3.0 | |
hooks: | |
- id: check-yaml | |
- id: end-of-file-fixer | |
language_version: python3 | |
- id: trailing-whitespace | |
- id: debug-statements | |
language_version: python3 |
This file contains 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
''' | |
Run the following commands (bc. gists don't allow directories) | |
pip install flask django dj-database-url psycopg2 | |
mkdir -p app/migrations | |
touch app/__init__.py app/migrations/__init__.py | |
mv models.py app/ | |
python manage.py makemigrations | |
python manage.py migrate |
This file contains 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
# Pass the env-vars to MYCOMMAND | |
eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
# … or ... | |
# Export the vars in .env into your shell: | |
export $(egrep -v '^#' .env | xargs) | |
# set variables from .compose.env but don't override existing exported vars | |
eval "$(grep -v '^#' .compose.env | sed -E 's|^(.+)=(.*)$|export \1=${\1:-\2}|g' | xargs -L 1)" | |
# Load up .env |
OlderNewer