A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| /**write your css in here**/ | |
| /* like */ | |
| <style> | |
| .CodeMirror{ | |
| font-family: "Consolas", sans-serif; | |
| } | |
| pre, code, kbd, samp { | |
| font-family: Consolas, monospace; |
| #!/usr/bin/env python | |
| """ | |
| simple example script for running and testing notebooks. | |
| Usage: `ipnbdoctest.py foo.ipynb [bar.ipynb [...]]` | |
| Each cell is submitted to the kernel, and the outputs are compared with those stored in the notebook. | |
| """ | |
| import os,sys,time |
| #!/bin/bash | |
| sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl | |
| sudo pip install virtualenvwrapper | |
| git clone https://github.com/yyuu/pyenv.git ~/.pyenv | |
| git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper | |
| echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc | |
| echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc |
| Git hook post-merge and post-checkout for sync modification time to last commit time. | |
| You can download scripts manually and install them yourself, or you can install it with command | |
| > curl -s https://gist.githubusercontent.com/phpdude/9464925/raw/install | sh | |
| This command will download post-merge script, chmod it, and create post-checkout symlink to post-merge hook. | |
| You can also start this script manually with environment variable $GIT_MERGE_LIMIT=100 to updated timestamp of last 100 commits for example. |
| #!/bin/bash | |
| # Adicione um novo remote; pode chamá-lo de "upstream": | |
| git remote add upstream https://github.com/usuario/projeto.git | |
| # Obtenha todos os branches deste novo remote, | |
| # como o upstream/master por exemplo: | |
| git fetch upstream |
| import time | |
| import boto3 | |
| import botocore | |
| def main(): | |
| db_identifier = 'yourDBID' | |
| rds = boto3.client('rds') | |
| try: |
| import io | |
| import sys | |
| class IteratorFile(io.TextIOBase): | |
| """ given an iterator which yields strings, | |
| return a file like object for reading those strings """ | |
| def __init__(self, it): | |
| self._it = it | |
| self._f = io.StringIO() |