pub-sub based simple message push system.
- pub-sub #admin publisher
- pub-sub #channel_name publisher
# vim: set fileencoding=utf8 | |
# http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html | |
# http://aws.typepad.com/aws/2014/01/amazon-sqs-new-dead-letter-queue.html | |
import json | |
import boto | |
from pprint import pprint | |
conn = boto.connect_sqs() | |
q1 = conn.create_queue('test_q1') |
$ sudo yum install -y libunwind perl-ExtUtils-Embed gperftools gperftools-libs gperftools-devel libxslt libxslt-devel GeoIP GeoIP-devel | |
$ ./configure \ | |
--add-module=./ngx_small_light \ | |
--prefix=/usr/share/nginx \ | |
--sbin-path=/usr/sbin/nginx \ | |
--conf-path=/etc/nginx/nginx.conf \ | |
--error-log-path=/var/log/nginx/error.log \ | |
--http-log-path=/var/log/nginx/access.log \ | |
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body \ | |
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy \ |
# http://www.kutukupret.com/2011/05/10/graphing-apachebench-results-using-gnuplot/ | |
# collect data | |
# $ ab -n 100 -c 4 -g imagemagick.tsv url | |
# $ ab -n 100 -c 4 -g gd.tsv url | |
# $ ab -n 100 -c 4 -g imlib2.tsv url | |
# plot data | |
# $ gnuplot template.p | |
# output as png image | |
set terminal png |
# vim: set fileencoding=utf8 | |
''' | |
References | |
- http://stackoverflow.com/a/1966188 | |
- http://en.wikipedia.org/wiki/Tree_(data_structure) | |
$ python suggest.py prefix | |
''' | |
import sys | |
import redis |
require 'rubygems' | |
require 'redis' | |
class RedisTrie | |
TERMINAL = '+' | |
def initialize(prefix) | |
@prefix = prefix | |
@r = Redis.new | |
end |
# vim: set fileencoding=utf8 | |
from tornado import ioloop | |
import functools | |
import os | |
import sys | |
def start(io_loop, check_time=500): | |
modify_times = {} # watch list | |
callback = functools.partial(_reload_on_update, modify_times) |
postgres=# copy t(id, name) from '/tmp/data.csv' (format csv) ; | |
COPY 5 | |
postgres=# select id , name, length(name) from t; | |
id | name | length | |
----+--------+-------- | |
1 | food | 4 | |
2 | energy | 6 | |
3 | '' | 2 | |
4 | | 0 | |
5 | | |
#! /usr/bin/env python | |
import redis | |
import random | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6379) | |
REDIS_SETGET = False | |
REDIS_HSET = False |
# vim: set fileencoding=utf8 | |
# | |
# authenticate with zabbix api server, and retrieve monitored hosts | |
# specification : https://www.zabbix.com/documentation/1.8/api | |
# | |
# $ python zabbix_api.py | |
import requests | |
from pprint import pprint | |
import json |