Skip to content

Instantly share code, notes, and snippets.

@jvanasco
jvanasco / parse_flake8.py
Created February 18, 2016 19:29
Flake8 output was giving me a headache, so i wrote this quick parser.
import argparse
import os.path
import pprint
_sample_data = """/Users/me/path/to/project/files/lib/data/bar.py:52:1: W293 blank line contains whitespace
/Users/me/path/to/project/files/lib/data/foo.py:101:1: W293 blank line contains whitespace
/Users/me/path/to/project/files/lib/utils/date.py:328:5: F811 redefinition of unused 'currentYear' from line 306
/Users/me/path/to/project/files/lib/utils/date.py:331:5: F811 redefinition of unused 'currentMonth' from line 310
/Users/me/path/to/project/files/lib/utils/date.py:334:5: F811 redefinition of unused 'currentDay' from line 314
/Users/me/path/to/project/files/lib/utils/foo.py:595:1: W293 blank line contains whitespace
@jvanasco
jvanasco / read_email.py
Created January 29, 2016 01:08
silly little file for reading postfix files on a dev server.
import argparse
import os
import subprocess
"""
$ mailq
show mail queue contents
$ sudo postcat -q {queue_id}
show message details
@jvanasco
jvanasco / dogpile_proxy.py
Created October 5, 2015 22:00
dogpile encoding
class _EncodedProxy(ProxyBackend):
def value_decode(self, value):
raise NotImplementedError("override me")
def value_encode(self, value):
raise NotImplementedError("override me")
def set(self, k, v):
v = self.value_encode(v)
@jvanasco
jvanasco / canned_reply.txt
Created August 21, 2015 15:42
canned reply for michael bayer
This bug report is being automatically closed because it did not meet one or more common-sense
and industry-standard reporting requirements.
Exact reasons have been marked below. If you can correct this, feel free to re-open.
___ The issue is not related to this library, but is a general issue with basic:
___ Python
___ Sql
___ The issue is not actually disclosed inline, but linked to an offsite article:
___ The issue is disclosed on StackOverflow.
@jvanasco
jvanasco / oauthlib_oauth1_interfaces.py
Created August 10, 2015 19:49
consolidated oauth1 object Interfaces used by oauthlib and flask-oauthlib
"""This explains some object interfaces used in validator.py
"""
class _DatabaseObject(object):
pass
class _Relationship(object):
pass
@jvanasco
jvanasco / test.py
Last active August 29, 2015 14:17
sqlalchemy desc error
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Use this file to build your own SSCCE
# SSCCE = Short, Self Contained, Correct (Compatible) Example
# see http://sscce.org/
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@jvanasco
jvanasco / view.py
Created March 9, 2015 18:37
pyramid finished_callbacks change
from pyramid.view import view_config
def sample_callback(request):
pass
@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
"""
1.6/master
BEFORE: request.finished_callbacks None
@jvanasco
jvanasco / 01-jv
Created March 5, 2015 19:32
Tech Support Exchange with Dreamhost, in which they completely ignore the question I ask.
I've been getting A TON of spam hitting my inbox lately. 20+ messages a day.
sometimes more. Usually in the topics of :
- Medicare
- Rewards cards (amazon, home depot)
- Background Checks
- Lawsuits
- EZPass
- Sex offender notification
- Auto Warranty
@jvanasco
jvanasco / example-association_proxy.py
Created February 11, 2015 19:13
association proxy example
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Use this file to build your own SSCCE
# SSCCE = Short, Self Contained, Correct (Compatible) Example
# see http://sscce.org/
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@jvanasco
jvanasco / app.py
Created January 21, 2015 20:25
pyramid and render_to_resposne
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from pyramid.renderers import render_to_response, render
def json_bad(request):
return render_to_response('json', {'hello': 'world'})
def json_good(request):
return render_to_response('json', {'hello': 'world'}, request=request)