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 "mongo" | |
require 'json' | |
connection = Mongo::Connection.new("localhost", 27017) | |
db = connection.db('log_201208') | |
col = db.collection('d_01') | |
col.create_index([['ts', Mongo::ASCENDING], ['pid', Mongo::DESCENDING]]) | |
col.create_index('status') | |
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 'tire' | |
require 'sanitize' | |
module Jekyll | |
class ElasticSearchIndexer < Generator | |
safe true | |
def generate(site) | |
Tire::Configuration.url(site.config['search_server']) |
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 Search = { | |
searchUrl: "http://search.xenji.com/xenjicom/_search", | |
processResults: function(results) { | |
if (typeof results != "undefined") | |
this.renderResults(results.hits); | |
}, | |
onkeypress: function(event) { |
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 'net/http' | |
require 'net/https' | |
BASEDIR = '/etc' | |
LAST_IP_FILE = "#{BASEDIR}/tunnelbroker.lastip" | |
# for debugging. | |
BE_VERBOSE = false |
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
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
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
function isNoHomepageSearch(input) { | |
return input !~ /bIsWorldwide/ | |
} | |
function getIp(input) { | |
return $3 | |
} | |
function isGetRequest(input) { | |
return input ~ /^"GET/ |
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 redis = require("redis"), | |
client = redis.createClient(); | |
var amqp = require('amqp'); | |
var amqpc = amqp.createConnection({ host: 'somehost', login: 'guest', password: 'guest', vhost: '/' }); | |
var geoip = require('geoip-lite'); | |
var ll = require("lazylines"); | |
amqpc.on('ready', function () { | |
amqpc.exchange('heatmap', {passive: true}, function(e){ | |
process.stdin.resume(); |
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 express = require('express'); | |
var app = express(); | |
var server = require('http').createServer(app); | |
var io = require('socket.io').listen(server); | |
var amqp = require('amqp'); | |
var amqpc = amqp.createConnection({ host: 'somehost', login: 'guest', password: 'guest', vhost: '/' }); | |
process.on('exit', function() { | |
amqpc.close(); | |
}); |
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
$(document).ready(function () { | |
var socket = io.connect('http://' + location.host), | |
$body = $('body'), | |
body_width = $body.width(), | |
body_height = $body.height(), | |
count_datapoints = 0, | |
$map = $('#map'), | |
datapoints = 1500, | |
heatmap = new google.maps.visualization.HeatmapLayer({ |
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
env COPTFLAGS="-O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing" CC=clang CXX=clang++ CPP=clang-cpp CFLAGS="-O2 -pipe -fno-strict-aliasing" ./configure --enable-fpm --with-fpm-user=www --with-fpm-group=www --disable-cgi --with-config-file-path=/usr/local/etc --with-config-file-scan-dir=/usr/local/etc/php.d --with-openssl --with-zlib --enable-bcmath --enable-calendar --with-curl --with-curlwrappers --enable-exif --enable-ftp --with-gd --with-t1lib --enable-gd-native-ttf --with-mhash --enable-intl --enable-mbstring --with-mcrypt --with-mysqli --enable-pcntl --with-pdo-mysql --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xsl --enable-zip --enable-mysqlnd --with-pear |