This is now an actual repo:
This file contains hidden or 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 | |
class base58 | |
{ | |
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; | |
public static function encode($int) { | |
$base58_string = ""; | |
$base = strlen(self::$alphabet); | |
while($int >= $base) { |
This file contains hidden or 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
var getGooglAuthToken = function(b){ | |
var c = function(){ | |
for (var l=0, m=0, ml=arguments.length; m<ml; m++) l = l + arguments[m] & 4294967295; | |
return l; | |
} | |
var d = function(l){ | |
l = String(l > 0 ? l : l + 4294967296); | |
var m = l; | |
for (var o=0, n=false, p=m.length-1; p>=0; --p){ | |
var q = Number(m.charAt(p)); |
This file contains hidden or 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
require 'redis' | |
# SADD key, member | |
# Adds the specified <i>member</i> to the set stored at <i>key</i>. | |
redis = Redis.new | |
redis.sadd 'my_set', 'foo' # => true | |
redis.sadd 'my_set', 'bar' # => true | |
redis.sadd 'my_set', 'bar' # => false | |
redis.smembers 'my_set' # => ["foo", "bar"] |
This file contains hidden or 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
import os | |
import httplib | |
import tornado.web | |
class ErrorHandler(tornado.web.RequestHandler): | |
"""Generates an error response with status_code for all requests.""" | |
def __init__(self, application, request, status_code): | |
tornado.web.RequestHandler.__init__(self, application, request) | |
self.set_status(status_code) | |
This file contains hidden or 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_search.py | |
Written by Josiah Carlson July 3, 2010 | |
Released into the public domain. | |
This module implements a simple TF/IDF indexing and search algorithm using | |
Redis as a datastore server. The particular algorithm implemented uses the |
This file contains hidden or 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
# not actually tested | |
from gevent.queue import Queue | |
from gevent.pool import Pool | |
class GreenPile(object): | |
def __init__(self, size_or_pool=1000): | |
if isinstance(size_or_pool, Pool): | |
self.pool = size_or_pool |
This file contains hidden or 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
require 'httparty' | |
require 'eventmachine' | |
class Request | |
include EM::Deferrable | |
@@requests = [] | |
attr_reader :method, :params |
This file contains hidden or 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
[unix_http_server] | |
file=/tmp/supervisor.sock ; path to your socket file | |
[supervisord] | |
logfile=/var/log/supervisord/supervisord.log ; supervisord log file | |
logfile_maxbytes=50MB ; maximum size of logfile before rotation | |
logfile_backups=10 ; number of backed up logfiles | |
loglevel=error ; info, debug, warn, trace | |
pidfile=/var/run/supervisord.pid ; pidfile location | |
nodaemon=false ; run supervisord as a daemon |
This file contains hidden or 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 | |
$posting = $database->postlist_begin( $search_id ); | |
$enquire = new XapianEnquire( $database ); | |
$rset = new XapianRset(); | |
$rset->add_document( $posting->get_docid() ); | |
$eset = $enquire->get_eset(20, $rset); | |
$i = $eset->begin(); | |
$terms = array(); |
OlderNewer