Skip to content

Instantly share code, notes, and snippets.

View nickretallack's full-sized avatar

Nick Retallack nickretallack

View GitHub Profile
>>> parser.raw_parse_sents(("the quick brown fox jumps over the lazy dog", "the quick grey wolf jumps over the lazy fox"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "nltk/parse/stanford.py", line 176, in raw_parse_sents
return self._parse_trees_output(self._execute(cmd, '\n'.join(sentences), verbose))
File "nltk/parse/stanford.py", line 106, in _parse_trees_output
res.append(Tree('\n'.join(cur_lines)))
File "nltk/tree.py", line 99, in __init__
% type(self).__name__)
TypeError: Tree: Expected a node value and child list
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.postgresql</string>
<key>ProgramArguments</key>
<array>
Nicholass-MacBook-Pro:kv nick$ iex --name foo
{error_logger,{{2014,8,12},{23,51,30}},"Protocol: ~tp: the name foo@Nicholass-MacBook-Pro.hsd1.ca.comcast.net. seems to be in use by another Erlang node",["inet_tcp"]}
{error_logger,{{2014,8,12},{23,51,30}},crash_report,[[{initial_call,{net_kernel,init,['Argument__1']}},{pid,<0.20.0>},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,322}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}},{ancestors,[net_sup,kernel_sup,<0.10.0>]},{messages,[]},{links,[#Port<0.263>,<0.17.0>]},{dictionary,[{longnames,true}]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,27},{reductions,779}],[]]}
{error_logger,{{2014,8,12},{23,51,30}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfargs,{net_kernel,start_link,[[foo,longnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worke
defmodule Burd.ThingsController do
use Phoenix.Controller
def index(conn, _params) do
json conn, JSON.encode! key: :value
end
end
[{webmachine_resource,do,3,[{file,"src/webmachine_resource.erl"},{line,142}]},
{webmachine_decision_core,resource_call,1,
[{file,"src/webmachine_decision_core.erl"},
{line,48}]},
{webmachine_decision_core,decision,1,
[{file,"src/webmachine_decision_core.erl"},
{line,209}]},
{webmachine_decision_core,handle_request,2,
[{file,"src/webmachine_decision_core.erl"},
{line,33}]},
[{wrq,set_resp_header,
["WWW-Authenticate",false,
{wm_reqdata,'GET',http,
{1,1},
"127.0.0.1","127.0.0.1",undefined,[],"/","/",[],[],".",500,
1073741824,67108864,
[{"splunkweb_csrf_token_8000","16498165946337228917"},
{"session",
"eyJfaWQiOnsiIGIiOiJaakF5TXpJMU1qbGlPV1F3TmpWaFlUWmtObVZpWm1RMFpESmlNekJrTVdZPSJ9LCJjc3JmX3Rva2VuIjp7IiBiIjoiTUdFM1kyTmtPRGt5TkRJMFkyWXhOekkzTldVM01UUmlOVE13T1RGbFltUTVPR1U1WW1FNE9RPT0ifX0.BtbFzg._hor0BK9vEVBx66MJM6JTn5br1I"}],
[],
@nickretallack
nickretallack / overrides.exs
Last active August 29, 2015 14:06
overrides in elixir
defmodule Foo do
defmacro __using__(_) do
quote do
def foo() do
IO.puts "Foo"
end
defoverridable [foo: 0]
end
end
end
defmodule Foo do
defmacro __using__(_) do
quote do
def foo() do
IO.puts "Foo"
end
defoverridable [foo: 0]
end
end
end
$ pip install pillow
Downloading/unpacking pillow
Downloading Pillow-2.5.3-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl (3.0MB): 3.0MB downloaded
Installing collected packages: pillow
Successfully installed pillow
Cleaning up...
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
@nickretallack
nickretallack / composite_keys.py
Last active August 29, 2015 14:07
This should work, right? This demonstrates an issue I'm having with composite primary keys.
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKey, Integer, String, ForeignKeyConstraint
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, relationship
Base = declarative_base()
class Tenant(Base):
__tablename__ = 'tenant'
id = Column(Integer, primary_key=True)