Skip to content

Instantly share code, notes, and snippets.

View tmountain's full-sized avatar

Travis Whitton tmountain

View GitHub Profile
#!/usr/bin/ruby
fh = File.new('/tmp/processManager.log', 'a')
IO.popen("supervisorctl status") do |process|
process.readlines.each do |line|
restart = false
queue, status, _, pid, _, time = line.split(/\s+/)
h, m, s = time.split(':')
(def num-agents 16)
(def work-buckets (partition-all (int (/ (count domain-list)
num-agents)) domain-list))
; returns a collection of agents for a given set of work buckets
(defn spawn-agents [agents buckets]
(if (empty? buckets)
agents
(recur (conj agents (agent (first buckets)))
SELECT c.*
FROM crawl AS c
WHERE domain IS NOT NULL
ORDER BY
(
SELECT SUM(cr.score)
FROM crawl AS cr
WHERE cr.domain = c.domain
) DESC LIMIT 10;
_ _______ _________ _______ _______ _ _______ _________ _______ _______
( ( /|( ____ \|\ /|\__ __/( ____ )( ___ )( ( /| ( ____ \\__ __/( ___ )( ____ )
| \ ( || ( \/| ) ( | ) ( | ( )|| ( ) || \ ( | | ( \/ ) ( | ( ) || ( )|
| \ | || (__ | | | | | | | (____)|| | | || \ | | | (_____ | | | (___) || (____)|
| (\ \) || __) | | | | | | | __)| | | || (\ \) | (_____ ) | | | ___ || __)
| | \ || ( | | | | | | | (\ ( | | | || | \ | ) | | | | ( ) || (\ (
| ) \ || (____/\| (___) | | | | ) \ \__| (___) || ) \ | /\____) | | | | ) ( || ) \ \__
|/ )_)(_______/(_______) )_( |/ \__/(_______)|/ )_) \_______) )_( |/ \||/ \__/
db.tracking.find( {"e.ac" : "KOI-9GNIC8"}).explain();
db.tracking.find({ "e.ac": "KOI-9GNIC8",
"co": 477,
"e": { $elemMatch:
{ ts:
{ $gte: 1381381140, $lte: 1381381160 }
}
}
}).explain();
MongoDB shell version: 2.0.4
connecting to: test
> use test
switched to db test
> doc = {'agg.1' : {'foo' : 'bar'}}
{ "agg.1" : { "foo" : "bar" } }
> db.derp.update({companyID : 123}, {'$set' : doc}, {'upsert' : true})
> db.derp.findOne()
{
"_id" : ObjectId("52825e36c7c75e4cf4e65481"),
Array
(
[WhoisRecord] => Array
(
[domainName] => 92.98.60.26
[status] => ASSIGNED PA
[rawText] => % This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'optparse'
def get_command_line
options = {}
OptionParser.new do |opts|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
define("L_DEBUG", 0);
define("L_INFO", 1);
define("L_WARN", 2);
define("L_ERROR", 3);
define("L_FATAL", 4);
if (!function_exists('l'))
{
<?php
function ensureURLEncoding($url)
{
$url = trim($url);
if (preg_match('#^(https?://)(.*)#', $url, $matches)) {
$protocol = $matches[1];
$path = $matches[2];
$path = implode("/", array_map("rawurlencode", explode("/", $path)));
return $protocol . $path;
}