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
%% use sync log so we can check if it caused a wrap event | |
%% and record the timestamp/num entries for the new wrapfile | |
%% (ie, collect metadata about each wrapfile.N, for faster seeking) | |
disk_log:blog(State#state.log, Line), | |
%% Fun used to write index marker, if we need to this insertion: | |
WriteIndexFun = fun(FileOffset) -> | |
Info = disk_log:info(State#state.log), | |
NoItems = proplists:get_value(no_items, Info), | |
CurrFile = proplists:get_value(current_file, Info), |
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
%% Just stores an in #state{} | |
-module(leadertest). | |
-behaviour(gen_leader). | |
%% API | |
-export([start_link/1, start_link/2, get_num/0, set_num/1, info/0]). | |
%% gen_leader callbacks | |
-export([init/1, |
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
import sys, os, pgq, skytools, json | |
class IRCLogger(pgq.Consumer): | |
def logIrcEvent(self, row): | |
"""log to disk""" | |
obj = json.loads(row['json']) | |
self.log.info("LOGGED EVENT JSON: %s", obj['msg']) | |
return True | |
def process_batch(self, src_db, batch_id, ev_list): |
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
net.ipv4.conf.all.rp_filter=1 | |
net.ipv4.icmp_echo_ignore_broadcasts=1 | |
kernel.shmmax = 1500000000 | |
net.ipv4.ip_local_port_range = 1024 65535 | |
vm.overcommit_memory = 1 | |
fs.file-max = 1000000 | |
# General gigabit tuning: |
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
%% Start a connection to the server | |
{ok, Connection} = amqp_connection:start(#amqp_params_network{}), | |
%% Once you have a connection to the server, you can start an AMQP channel | |
{ok, Channel} = amqp_connection:open_channel(Connection), | |
%% Now that you have access to a connection with the server, you can declare a queue and bind it to an exchange | |
%% Routing topology: | |
%% | |
%% All msgs go to irc_x (fanout exchange) | |
%% exchange-to-exchange bindings spread msgs to these exchanges: |
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
-module(sc). | |
-define(DEBUG(S,A), io:format(S++"\n",A)). | |
-behaviour(gen_server). | |
%% API | |
-export([start_link/0, start/0]). | |
%% gen_server callbacks | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, |
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 | |
// test str/*{{{*/: | |
$str = <<<EOF | |
{ | |
"before": "5aef35982fb2d34e9d9d4502f6ede1072793222d", | |
"repository": { | |
"url": "http://github.com/defunkt/github", | |
"name": "github", | |
"description": "You're lookin' at it.", | |
"watchers": 5, |
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
#!/bin/bash | |
# Install fake erlang packages, then the ESL package | |
# Afterwards, installing packages that depend on erlang, like rabbitmq, | |
# will use the ESL packaged erlang without installing the older disto ones | |
# | |
apt-get install equivs | |
# Create fake erlang packages, since we are using esl-erlang instead | |
cd /tmp | |
apt-get install -y equivs |
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
*** CLICK "RAW" LINK ABOVE TO GET IT LINE WRAPPED ETC *** | |
\d+ ircevents | |
Column | Type | Modifiers | |
-----------+---------+------------------------ | |
buffer | integer | not null | |
id | bigint | not null <---------------- unixtime in microsecs (since epoch*1,000,000) | |
type | text | not null |
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
// Generic TCP proxy that adds delay on packets in both directions | |
var net = require('net'), | |
repl = require('repl'), | |
sys = require('sys'); | |
var listenPort = 19999, |