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
;;; personal.el -- personal modifications | |
;;; Commentary: | |
;;; provide personal modifications | |
;;; Code: | |
(set-face-attribute 'default nil :height 140) | |
(prelude-require-packages '(color-theme-sanityinc-tomorrow paredit ac-geiser | |
geiser)) | |
(provide 'personal) |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant::Config.run do |config| | |
# config.vm.define :web do |web_config| | |
# web_config.vm.box = 'telly-base' | |
# web_config.vm.provision :shell, :path => "provisioners/web.sh" | |
# web_config.vm.forward_port 80, 6060 | |
# web_config.vm.network :hostonly, "254.168.1.10" | |
# end |
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
redis 127.0.0.1:6379[2]> zrevrange activity_feed:1:2 0 10 | |
1) "activity_aggr:1:like:1:15488.0" | |
2) "activity_aggr:1:picture:1:15488.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
>>> tasks.follow_user.delay(1, 2) | |
<AsyncResult: c570c9c3-13d8-4688-ae41-0ebbdc337f45> |
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
redis 127.0.0.1:6379[2]> keys * | |
1) "activity_aggr:1:picture:1:15488.0" # Aggregation for picture, user 1 and day 15488 | |
2) "activity:1:1338243610.94:like" # Individual activity | |
3) "activity:1:1338243622.3:picture" # Individual activity | |
4) "activity_aggr:1:like:1:15488.0:counter" # counter for like, user 1 and day 15488 | |
5) "activities:1" # All activities that user 1 has ever done. | |
6) "activity_profile:1:1" # Profile feed for user 1 | |
7) "activity:1:1338243599.68:picture" # Individual activity | |
8) "activity_aggr:1:like:1:15488.0" # Aggregation for like, user 1 and day 15488 | |
9) "activity_aggr:1:picture:1:15488.0:counter" # Counter for picture, user 1 and day 15488 |
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
Python 2.7.3 (default, Apr 20 2012, 22:39:59) | |
[GCC 4.6.3] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import time | |
>>> import tasks | |
>>> tasks.new_activity.delay(1, time.time(), 'picture') | |
<AsyncResult: 1cffc586-0442-4824-8c8f-7fc2c72de1ff> | |
>>> tasks.new_activity.delay(1, time.time(), 'like') | |
<AsyncResult: 20683c9f-676d-4f52-a911-b561f651bb0b> | |
>>> tasks.new_activity.delay(1, time.time(), 'picture') |
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
# -*- coding: utf-8 -*- | |
# Copyright (c) 2012, Scott Reynolds | |
# All rights reserved. | |
from mongokit import Document, UpdateQueryError | |
from pymongo.errors import OperationFailure | |
from bson import BSON | |
import hashlib | |
class IdempotentDocument(Document): |
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
<?php | |
public function createQueryDSL($query, $skip, $limit) { | |
$query_json = array( | |
'query' => array( | |
'custom_filters_score' => array( | |
'query' => array( | |
'query_string' => array( | |
'fields' => array('title^5', 'message', 'vanity_url^3', 'full_name^5'), | |
'query' => $query, |
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
total = self.document_storage.count() | |
scope = dict(total=total) | |
results = self.collection.map_reduce( | |
map_function, | |
reduce_function, | |
finalize=finalize_function, | |
scope=scope, | |
query={'term': { '$in': list(terms)}}, |
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
finalize_function = bson.Code( | |
"function (key, value) {" | |
" var score = value.tf * Math.log(total / value.df);" | |
" return score;" | |
"}") |
NewerOlder