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
""" | |
flask-smorest does not support filtering out routes and schemas for public and internal docs. | |
This is a helper to support this use case. | |
* Ensure that you have no config values prefixed with `OPENAPI_` except `OPENAPI_VERSION`. | |
Setting these values enables flask-smorest's documentation routes which we do not want. | |
* Annotate an endpoint with the `@public_docs` decorator. Example: | |
```python | |
from my_project.api_docs import public_docs |
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
# Loosely based on https://github.com/h/marshmallow_enum | |
from marshmallow.fields import Field | |
class EnumField(Field): | |
default_error_messages = { | |
'invalid': 'Invalid enum value {input}', | |
} |
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
class Base(object): | |
def __init__(self, foo='foo_text', bar='bar_text'): | |
self.foo = foo | |
self.bar = bar | |
class Child(Base): | |
def __init__(self, extra='extra_text', *arg, **kwargs): | |
self.extra = extra | |
super(Child, self).__init__(*arg, **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
================================================================================ | |
Recipe Compile Error in /var/chef/cache/cookbooks/fh-dynoman/recipes/default.rb | |
================================================================================ | |
NoMethodError | |
------------- | |
undefined method `time' for Chef::Resource::Cron | |
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
712145 function calls (702303 primitive calls) in 0.840 seconds | |
Ordered by: cumulative time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1 0.000 0.000 0.798 0.798 /Users/peter/.virtualenvs/drf-perf/lib/python3.4/site-packages/django/views/decorators/csrf.py:57(wrapped_view) | |
1 0.000 0.000 0.798 0.798 /Users/peter/.virtualenvs/drf-perf/lib/python3.4/site-packages/rest_framework/viewsets.py:69(view) | |
1 0.000 0.000 0.798 0.798 /Users/peter/.virtualenvs/drf-perf/lib/python3.4/site-packages/rest_framework/views.py:442(dispatch) | |
1 0.000 0.000 0.797 0.797 /Users/peter/.virtualenvs/drf-perf/lib/python3.4/site-packages/rest_framework/mixins.py:18(create) | |
1 0.000 0.000 0.414 0.414 /Users/peter/.virtualenvs/drf-perf/lib/python3.4/site-packages/rest_framework/serializers.py:198(is_valid) |
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
# Place in /usr/local/Library/Formula/, then | |
# brew install protobuf-py3 | |
class ProtobufPy3 < Formula | |
url "https://github.com/GreatFruitOmsk/protobuf-py3/archive/2.5.1.tar.gz" | |
version "2.5.1" | |
sha256 "496484244288b6e9b7d94baac71a3c0ea19c2a381a8a8685f0ff4235e81b1b38" | |
conflicts_with "protobuf", :because => "protobuf-py3 is incompatible with protobuf" |
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
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
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
/** | |
* AppleScript to launch iterm2 terminals/tabs with configurable: | |
* ~ Name <name> | |
* ~ List of commands <cmds> | |
* ~ Split behavior horizontal(h) or vertical(v) <split> :: (h, v) | |
* | |
* Run from terminal with `osascript iterm-launcher.js`. | |
* Don't unfocus with the mouse/keyboard while executing the script. | |
* | |
* JS port of https://github.com/luismartingil/scripts/blob/master/iterm_launcher02.applescript |
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
# These instructions were tested on Ubuntu 12.04 64bit | |
# Be prepared to wait a while... | |
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev libxext-dev libpq-dev libx11-dev | |
git clone git://github.com/antialize/wkhtmltopdf.git | |
git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt | |
cd wkhtmltopdf | |
mkdir static-build | |
ln -s ../wkhtmltopdf-qt static-build/qt | |
./scripts/static-build.sh |
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.shortcuts import render_to_response | |
from django.core.urlresolvers import reverse | |
from django.http import HttpResponseRedirect | |
import gdata.gauth | |
import gdata.contacts.client | |
CONSUMER_KEY = 'nothx' | |
CONSUMER_SECRET = 'nothx' | |
SCOPE = ['https://www.google.com/m8/feeds/'] | |
DOMAIN = 'nothx' |