(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf
:
/var/log/celery/*.log { | |
weekly | |
missingok | |
rotate 52 | |
compress | |
delaycompress | |
notifempty | |
copytruncate | |
} |
import fcntl | |
import os | |
import struct | |
import subprocess | |
# Some constants used to ioctl the device file. I got them by a simple C | |
# program. | |
TUNSETIFF = 0x400454ca | |
TUNSETOWNER = TUNSETIFF + 2 |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
#-*- coding:utf-8 -*- | |
import Queue | |
from contextlib import contextmanager | |
class ObjectPool(object): | |
"""A simple object pool with thread safe""" | |
def __init__(self,objectFn,*args,**kwargs): | |
super(ObjectPool, self).__init__() | |
self.objectFn = objectFn | |
self.objectCls = None |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
from heapq import heapify, heappop | |
from binascii import a2b_hex | |
from collections import defaultdict | |
from struct import unpack | |
from sys import argv, exit | |
def parse_byte(bstring): | |
return unpack('>B', a2b_hex(bstring))[0] | |
def dijkstra(graph, source): |
[isayme] | |
text(bold)=eaeaea | |
magenta(bold)=ff00ff | |
text=ffffff | |
white(bold)=eaeaea | |
green=00c000 | |
red(bold)=d20000 | |
green(bold)=00ff00 | |
black(bold)=808080 | |
red=c00000 |
def print_table(items, header=None, wrap=True, max_col_width=20, wrap_style="wrap", row_line=False, fix_col_width=False): | |
''' Prints a matrix of data as a human readable table. Matrix | |
should be a list of lists containing any type of values that can | |
be converted into text strings. | |
Two different column adjustment methods are supported through | |
the *wrap_style* argument: | |
wrap: it will wrap values to fit max_col_width (by extending cell height) | |
cut: it will strip values to max_col_width |