Installing rabbitmq: https://bugzilla.mozilla.org/show_bug.cgi?id=561459#c0
$ rabbitmq-server +---+ +---+ | | | | | | | |
1. Start gearman `server` on some machine (here `worker` machine): | |
$ gearmand --port 8888 | |
2. Connect a `worker` to the server | |
$ gearman -h IP -p 8888 -w -f test wc | |
$ gearman -h 127.0.0.1 -p 8888 -w -f test executable_script | |
3. Push a job to queue by calling: | |
$ gearman -h IP -p 8888 -f test "SOME DATA TO PROCESS OR ARGS" | |
Notes: | |
* Gearman does NOT spawn any `worker` processes, therefore if a number of `workers` |
sudo ifconfig eth0 192.168.1.50 netmask 255.255.255.0 up | |
sudo ifconfig eth0 hw 00:00:00:00:00:00 | |
sudo route add default gw 172.16.236.0 | |
Display current active Internet connections: | |
netstat -nat | |
Display open ports | |
sudo netstat -tulp || sudo netstat -tulpn |
Simple snippets for http://github.com/alfredwesterveld/java-schedule-broadcaster |
<?php | |
namespace bar; | |
class Test {} |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>そう簡単には読ませてあげませんったー</title> | |
<link href="style.css" rel="stylesheet"> | |
<script src="http://www.google.com/jsapi"></script> | |
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
google.load('jquery', '1.4.3'); |
Some thoughts about Celery and logging | |
====================================== | |
LoggerAdapter | |
------------- | |
It appears that the use of LoggerAdapter is to get the processName into the | |
LogRecord (at least, that's what _CompatLoggerAdapter does) but if | |
LoggerAdapter is defined in logging, _CompatLoggerAdapter won't be used. |
$ rabbitmq-server +---+ +---+ | | | | | | | |
class BackupArchiveGenerator(Task): | |
def get_archive_name(self, tenant, date, archive): | |
""" | |
Build and return the archive name based on the requested archive. | |
""" | |
filename = '%s_to_%s' % (date.strftime('%Y_%m_%d'), datetime.datetime.today().strftime('%Y_%m_%d')) | |
if archive: | |
filename = "%s_archive" % filename | |
destination = os.path.join(tenant.subdomain, '%s.zip' % filename) |
L1 cache reference | 0.5 ns | |
Branch mispredict | 5 ns | |
L2 cache reference | 7 ns | |
Mutex lock/unlock | 25 ns | |
Main memory reference | 100 ns | |
Compress 1K bytes w/ cheap algorithm | 3,000 ns | |
Send 2K bytes over 1 Gbps network | 20,000 ns | |
Read 1 MB sequentially from memory | 250,000 ns | |
Round trip within same datacenter | 500,000 ns | |
Disk seek | 10,000,000 ns |
#!/usr/bin/env python | |
""" | |
test_http_conns.py - Tests for how HTTP persistent connections are handled, | |
including pipelining. | |
This script will set up a server which summarises how a browser connecting | |
to it behaves. For example, FireFox with pipelining turned on will give: | |
--->8--- |