Skip to content

Instantly share code, notes, and snippets.

View jlafon's full-sized avatar

Jharrod LaFon jlafon

View GitHub Profile
======================================================================
ERROR: test_invalid_data (validation.tests.PostNestResouceValidationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jharrodlafon/sources/django-tastypie/tests/validation/tests.py", line 56, in test_invalid_data
resp = self.client.post('/api/v1/notes/', data=data, content_type='application/json')
File "/Users/jharrodlafon/.virtualenv/tastypie-testing/lib/python2.7/site-packages/django/test/client.py", line 463, in post
response = super(Client, self).post(path, data=data, content_type=content_type, **extra)
File "/Users/jharrodlafon/.virtualenv/tastypie-testing/lib/python2.7/site-packages/django/test/client.py", line 297, in post
return self.request(**r)
@jlafon
jlafon / gist:6030948
Created July 18, 2013 16:55
Stack trace from elasticluster
$ mkvirtualenv elasticluster
(elasticluster) $ pip install elasticluster
...
(elasticluster) $ elasticluster list
WARNING:gc3.elasticluster:Deploying default configuration file to /Users/jlafon/.elasticluster/config.
Traceback (most recent call last):
File "/Users/jlafon/.virtualenv/elasticluster/bin/elasticluster", line 8, in <module>
load_entry_point('elasticluster==1.0.0', 'console_scripts', 'elasticluster')()
File "/Users/jlafon/.virtualenv/elasticluster/lib/python2.7/site-packages/elasticluster/main.py", line 152, in main
app.run()
@jlafon
jlafon / git-segfault.patch
Created August 16, 2013 02:03
git patch for submodule seg fault
Here is an example .gitmodules that will cause a segmentation fault:
[submodule "foo-module"]
path
url = http://host/repo.git
$ git status
Segmentation fault (core dumped)
This occurs because in the function parse_submodule_config_option, the
variable 'value' is assumed not to be null, and when passed as an
@jlafon
jlafon / centralized.csv
Last active January 2, 2016 08:19
Heatmap using D3 with legend.
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Sender Receiver Bytes
0 0 0
0 1 1416764092
0 2 4098253320
0 3 2106916386
0 4 1262617412
0 5 1059002706
0 6 891019678
0 7 719843912
0 8 794784178
@jlafon
jlafon / pynamodb_large_item.py
Created March 21, 2014 01:24
A PynamoDB example for items larger than 64k.
from pynamodb.models import Model
from pynamodb.attributes import (
UnicodeAttribute, NumberAttribute
)
class Thread(Model):
table_name = "Thread"
forum_name = UnicodeAttribute(hash_key=True)
subject = UnicodeAttribute(range_key=True)
@jlafon
jlafon / .gitconfig
Created March 26, 2014 13:11
My git aliases
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
@jlafon
jlafon / keybase.md
Created March 27, 2014 17:15
Keybase proof

Keybase proof

I hereby claim:

  • I am jlafon on github.
  • I am jlafon (https://keybase.io/jlafon) on keybase.
  • I have a public key whose fingerprint is 852D 73C3 9990 1540 B38C DE44 8D70 F113 3806 3D18

To claim this, I am signing this object:

from __future__ import print_function
import logging
from pynamodb.models import Model
from pynamodb.attributes import (UnicodeAttribute)
logging.basicConfig()
log = logging.getLogger("")
log.setLevel(logging.DEBUG)
log.propagate = True
@jlafon
jlafon / default_vals.py
Created May 21, 2014 14:31
Default attribute values
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute
def make_id():
return somerandomid
class Thread(Model):
table_name = 'Thread'
forum_name = UnicodeAttribute(hash_key=True)
@jlafon
jlafon / issue_25.py
Last active August 29, 2015 14:01
Issue 25 example
import random
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute, NumberAttribute
from pynamodb.indexes import LocalSecondaryIndex, AllProjection
class ViewIndex(LocalSecondaryIndex):
"""
This class represents a local secondary index
"""