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
#!/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(':') |
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
(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))) |
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
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; |
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
_ _______ _________ _______ _______ _ _______ _________ _______ _______ | |
( ( /|( ____ \|\ /|\__ __/( ____ )( ___ )( ( /| ( ____ \\__ __/( ___ )( ____ ) | |
| \ ( || ( \/| ) ( | ) ( | ( )|| ( ) || \ ( | | ( \/ ) ( | ( ) || ( )| | |
| \ | || (__ | | | | | | | (____)|| | | || \ | | | (_____ | | | (___) || (____)| | |
| (\ \) || __) | | | | | | | __)| | | || (\ \) | (_____ ) | | | ___ || __) | |
| | \ || ( | | | | | | | (\ ( | | | || | \ | ) | | | | ( ) || (\ ( | |
| ) \ || (____/\| (___) | | | | ) \ \__| (___) || ) \ | /\____) | | | | ) ( || ) \ \__ | |
|/ )_)(_______/(_______) )_( |/ \__/(_______)|/ )_) \_______) )_( |/ \||/ \__/ | |
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
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(); |
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
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"), |
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
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. |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'json' | |
require 'optparse' | |
def get_command_line | |
options = {} | |
OptionParser.new do |opts| |
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 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')) | |
{ |
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 | |
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; | |
} |