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
ERROR:root:Uncaught exception POST /audit/computer01 (127.0.0.1) | |
HTTPRequest(protocol='http', host='localhost:8888', method='POST', uri='/audit/computer01', version='HTTP/1.1', remote_ip='127.0.0.1', body='{"date": "2011-11-11","applications":[{"name":"Adobe CS4", "vendor":"Adobe, Inc.", "version":"9.2.0"}]}', headers={'Host': 'localhost:8888', 'Content-Type': 'applications/json', 'Content-Length': '103', 'Accept': '*/*', 'User-Agent': 'curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6'}) | |
Traceback (most recent call last): | |
File "/home/george/Repos/auditr/envs/auditr/lib/python2.6/site-packages/tornado/web.py", line 954, in _execute | |
getattr(self, self.request.method.lower())(*args, **kwargs) | |
File "server.py", line 83, in post | |
application['version'] | |
File "/home/george/Repos/auditr/envs/auditr/lib/python2.6/site-packages/tornado/database.py", line 111, in query | |
column_names = [d[0] for d in cursor.description] | |
TypeError: 'NoneType' object is |
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
SELECT | |
a.application_id, | |
a.application_name, | |
a.application_vendor, | |
a.application_version, | |
(SELECT COUNT(*) FROM installations i WHERE i.application_id=a.application_id) count | |
FROM | |
applications a | |
WHERE | |
1=1 |
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
$.fn.orderly = function(method, options) { | |
// Decide which method we're supposed to call and call it | |
if (methods[method]) { | |
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); | |
} else if (typeof method === 'object' || ! method) { | |
return methods.init.apply(this, arguments); | |
} else { | |
$.error('Method ' + method + ' does not exist on jQuery.orderly'); | |
} | |
}; |
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
// base class | |
function Animal() { | |
// constructor | |
} | |
Animal.prototype.makeNoise = function() { | |
// make noise | |
} | |
// first sub-class | |
function Dog() { |
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
/* | |
celebrity.c | |
Author: George Lesica | |
Description: An implementation of the celebrity | |
graph algorithm. | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> |
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
#!/bin/bash | |
# install.sh | |
# Author: George Lesica <[email protected]> | |
# Description: Deploy script for my dotfiles repo. | |
# License: Public Domain (where it exists), any OSI-approved | |
# license elsewhere. | |
# | |
# Configuration |
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
/* | |
shotgun.c | |
Author: George Lesica <[email protected]> | |
Description: An ANSI C implementation of the shotgun sorting algorithm. | |
*/ | |
#include <stdlib.h> | |
/* Private utility functions. */ |
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
""" | |
Function to find the contiguous subsequence in a | |
list that has the greatest sum. | |
""" | |
def max_subsequence(L): | |
""" | |
Implements a linear time algorithm. | |
>>> max_subsequence([1,2,3,4,5]) |
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
>>> a = re.compile(r'^[0-9_]+|\W|[_]+$') | |
>>> a.findall('__hello world') | |
['__', ' '] | |
>>> a.sub('', '[email protected]_table name hello') | |
'usernamegmailcom_tablenamehello' | |
>>> a.sub('', 'a') | |
'a' | |
>>> a.sub('', '_') | |
'' | |
>>> a.sub('', '0') |
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
# In views.py | |
import flask | |
from flask import request, session, g | |
from datably import app, crypt, db | |
from datably import operations as ops | |
@app.route('/login', methods=('GET', 'POST')) | |
def login(): | |
context = {} |