- 3712 E. Isabella Ave, Mesa, AZ
- Email: [email protected]
- Blog: http://www.monkinetic.com
- About Me: http://www.monkinetic.com/about-this-site.html
- Phone: (480) 208-6066
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
/** | |
update stats for the URL | |
*/ | |
hit_emitter.on('newHit', function(url, hit){ | |
var data = { "$push": { "stats.hits": hit }, "$inc": { "stats.hitcounter": 1 } } | |
urlProvider.update(url, data, function(error, url){ | |
console.log('updated hit: ' + JSON.stringify(url)); | |
}); | |
}); |
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
{ | |
"id":"dbauser", | |
"uid":506, | |
"comment":"DBA User", | |
"shell":"/bin/bash", | |
"groups": [ | |
"sysadm", | |
"dba" | |
], | |
"ssh_key": "XXXXXXXXXX" |
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
def jsonp(f): | |
"""Wrap a json response in a callback, and set the mimetype (Content-Type) header accordingly | |
(will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters | |
are provided, will wrap the json output in callback({thejson}) | |
Usage: | |
@jsonp | |
def my_json_view(request): | |
d = { 'key': 'value' } |
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
from functools import wraps | |
def recordstats(stat_prefix=None): | |
"""Record that this function was called, with duration | |
Usage: | |
@recordstats('stats_prefix') | |
def my_view(request): | |
return HTTPResponse(the_content) |
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
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Archive - {{ site.title }}</title> | |
<meta name="author" content="{{ user.display_name }}"> | |
<meta name="description" content="{{ site.description }}"> | |
<meta name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1"> | |
<link href="/atom.xml" rel="alternate" title="{{ site.url }} feed" type="application/atom+xml"> |