Skip to content

Instantly share code, notes, and snippets.

View neilkod's full-sized avatar

neil kodner neilkod

View GitHub Profile
System.NullReferenceException
Object reference not set to an instance of an object.
Stack Trace:
at Quest.Toad.CodeInsight.LanguageDialect.CompareObject(BaseObject obj, String schema, String owner, String name)
at Quest.Toad.CodeInsight.BaseDialect.GenerateInsight(IConnection connection, String defaultSchema, Boolean filtering, Insight insight, Boolean secondary, Boolean& hasSecondary, List`1 ownerList)
at Quest.Toad.CodeInsight.BaseDialect.GetInsight(IConnection connection, IParserChunk chunk, Int32 offset, String defaultSchema, Int32& startOffset, Boolean& hasSecondary, Boolean filtering, Boolean secondary, HotTokenInsight hotToken)
at Quest.Toad.Editor.Commands.InvokeMemberListCommand.FetchMemberListItems(Object editorText)
@neilkod
neilkod / table.html
Created June 8, 2011 12:12
extra </tr> tag on line 33 - trying to scrape the table using beautifulsoup
<table width="514" cellpadding="3" cellspacing="0" class="pollentable">
<tbody>
<tr>
<td width="100"></td>
<td width="400"><img src="images/polen_graph.png" alt="" width="399" height="43" border="0"></td>
</tr>
<!--START-->
<tr>
<td><strong>Cedar</strong></td>
<td align="left"><img src="http://www.intermountainallergy.com/images/gl.jpg" width="400" height="10" alt="bar in graph"></td>
@neilkod
neilkod / gist:993787
Created May 26, 2011 18:59
summarize these 16 values according to a defined scale
Goal: To summarize these 16 values and rate it on my scale. My first inclination is to use the median value(80). I didn't think the average is accurate because sometimes the data can be highly skewed.
scale: {40: 'extra low', 80: 'low', 160: 'moderate', 240: 'high-moderate', 320: 'high', 400 : 'extra high'}
>>> pd.values()
[160, 80, 80, 120, 240, 400, 80, 80, 400, 240, 80, 80, 160, 80, 80, 80]
>>> numpy.std(pd.values())
107.9062092745362
hadoop4:utahpollen nkodner$ python pollen.py
Cedar 160
Ash 160
Box Elder/ Maple 80
Sycamore 80
Birch 80
Cottonwood 80
Willow 40
Oak 40
Russian Olive 40
@neilkod
neilkod / gist:956039
Created May 4, 2011 21:09
get_database_parameters.py
def get_database_parameters(db_name):
""" given a database name (db_name), returns a dict with
host, database, username, password """
keys = ['hostname', 'database', 'username', 'password']
values = [dbconfig.get(db_name, x) for x in keys]
db_params = dict(zip(keys, values))
return db_params
@neilkod
neilkod / datetime.py
Created May 3, 2011 01:08
please help me get this to run in python 2.4
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> month_begin_date = '201104'
>>> friendly_date = datetime.datetime.strptime(month_begin_date,'%Y%m').strftime('%B, %Y')
>>> print friendly_date
April, 2011
>>>
mike korir 950 BROWARD COUNTY PUBLIC SCHOOLS 15.83
evan dehart 983 MOSS & ASSOCIATES 16.38
ronnie holassie 994 INDIVIDUAL 16.57
trey andrews 998 RUNNER'S EDGE, THE 16.63
michael stone 1028 RUNNER'S EDGE, THE 17.13
matthew kelly 1067 CLUB MED 17.78
joel cardosa 1101 BROWARD COUNTY PUBLIC SCHOOLS 18.35
alan beach 1103 SHELTAIR AVIATION 18.38
robert leaf 1108 BROWARD COUNTY PUBLIC SCHOOLS 18.47
joe monks 1114 BROWARD COUNTY PUBLIC SCHOOLS 18.57
#!/bin/python
f=open('5k.txt')
# column headers
print ','.join(['runner_name','seconds','team','minutes'])
for line in f:
data = line.strip()
(bib,name,time,gender,team) = data.split('\t')
# split the time on :. If it has 2 components then it's MM:SS.
# if 3 components then HH:MM:SS
@neilkod
neilkod / idle session pga usage.sql
Created February 23, 2011 15:12
show sessions idle for 10, 15, 30, 60, 90, 120 mins and their pga usage.
set linesize 200
select b.username
, count(*) "sessions"
, round(sum(a.pga_alloc_mem)/1024/1024) "all sessions mb"
, round(avg(b.last_call_et/60)) "avg idle time"
, round(avg(a.pga_alloc_mem)/1024/1024) "avg mb"
, sum(case when b.last_call_et >=600 then 1 else 0 end) "idle 10"
, round(sum(case when b.last_call_et >=600 then a.pga_alloc_mem else 0 end)/1024/1024) "idle 10 MB"
, sum(case when b.last_call_et >=900 then 1 else 0 end) "idle 15"
, round(sum(case when b.last_call_et >=900 then a.pga_alloc_mem else 0 end)/1024/1024) "idle 15 MB"
[(u'10alaorganizacion', 1), (u'10decedj', 1), (u'10questionstoask', 1), (u'110205ko', 1), (u'11desetembroRJ', 1), (u'12days', 1), (u'140conf', 1), (u'15minutes', 1), (u'1960sIBM', 1), (u'1stPrize', 1), (u'2012Feelings', 1), (u'21inc', 1), (u'21stcentury', 1), (u'24h', 1), (u'27c3', 1), (u'2DAMN', 1), (u'2daymission', 1), (u'3rdtimesthecharm', 1), (u'3thingsfebruary', 1), (u'40principales', 1), (u'48uurlk', 1), (u'4G', 1), (u'4Sq', 1), (u'4chan', 1), (u'4sqFatigue', 1), (u'4square', 1), (u'4thewin', 1), (u'52Cups', 1), (u'56k', 1), (u'56kfeelings', 1), (u'5AMConfCallAck', 1), (u'66PCNPR', 1), (u'66PNPR', 1), (u'66pctNpR', 1), (u'66porcento', 1), (u'66porcenton\xe3opodereclamar', 1), (u'66valley', 1), (u'6daystofreedom', 1), (u'8counts', 1), (u'93connected', 1), (u'ABC', 1), (u'ABG', 1), (u'ACS', 1), (u'AD', 1), (u'AEC', 1), (u'AGBT', 1), (u'AI', 1), (u'AIR', 1), (u'AISIM', 1), (u'AJ3K', 1), (u'ALUdev', 1), (u'ANC', 1), (u'ANTOFA', 1), (u'APEX', 1), (u'APIs', 1), (u'ARDrone', 1), (u'ARchat', 1), (u'ASKFORAJOKE'