Most operating systems can change the open-files limit for the current shell session using the ulimit -n command:
ulimit -n 200000
/var/lib/redis/logs/redis.log { | |
daily | |
rotate 14 | |
copytruncate | |
delaycompress | |
compress | |
notifempty | |
missingok | |
} |
#!/usr/bin/env python | |
import sys | |
from random import random | |
from time import sleep | |
from threading import Thread, active_count | |
execfile('gunicorn.conf.py') |
#!/usr/bin/env bash | |
# This script prints out all of your Redis keys and their size in a human readable format | |
# Copyright 2013 Brent O'Connor | |
# License: http://www.apache.org/licenses/LICENSE-2.0 | |
human_size() { | |
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
} |
import time | |
import calendar | |
import email.utils as eutils | |
def gmtstr2timestamp(gmtstr): | |
"""Transform GMT time string to Unix timestamp. | |
format:: '%a %d %b %Y %H:%M:%S %Z' | |
""" |
#!/usr/bin/env python | |
# http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
import pika | |
import sys | |
connection = pika.BlockingConnection(pika.ConnectionParameters( | |
host='localhost')) | |
channel = connection.channel() | |
message = ' '.join(sys.argv[1:]) or "Hello World!" |
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
SHELL := /bin/bash | |
REV := $(shell git rev-parse HEAD) | |
CHANGES := $(shell test -n "$$(git status --porcelain)" && echo '+CHANGES' || true) | |
TARGET := packer-provisioner-itamae-local | |
VERSION := $(shell cat VERSION) | |
OS := darwin freebsd linux openbsd | |
ARCH := 386 amd64 |
import itertools | |
def pairwise(seq): | |
"""All credit to http://stackoverflow.com/a/5389547 .""" | |
iter_seq = iter(seq) | |
return itertools.izip(iter_seq, iter_seq) |