View github.css
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
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
View nginx.conf
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
#涉及到真实的服务器地址一律以 myselfoss.com 代替 | |
server { | |
listen 80; | |
server_name myselfoss.com; | |
index index.php index.html index.htm; | |
root /home/wwwroot/rss; | |
error_log /var/log/nginx/rss.error.log; | |
access_log off; | |
location ~ \.php$ |
View sudoku.py
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
#!/usr/bin/env python | |
#coding=utf-8 | |
units = ([[j for j in range(81) if j%9 == i] for i in range(9)] + | |
[[j for j in range(81) if j/9 == i] for i in range(9)] + | |
[[j for j in range(81) if (j%9)/3+(j/27)*3 == i] for i in range(9)]) | |
uindexs = [[j for j, u in enumerate(units) if i in u] for i in range(81)] | |
class Sudoku(object): |
View 1) Install
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
// --- Compiling --- | |
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz | |
$ tar xzvf redis-2.8.3.tar.gz | |
$ cd redis-2.8.3 | |
$ make | |
$ make install | |
// --- or using yum --- | |
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |
View decorator.py
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 functools, inspect | |
def _strict_type(type_map): | |
''' | |
Check func parameter type | |
:param f: func | |
:param type_map: mapping of parameter types | |
:return: | |
''' | |
def _wrapped(f): |
View osx_notify.py
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
# coding: utf-8 | |
from Foundation import NSUserNotification | |
from Foundation import NSUserNotificationCenter | |
from Foundation import NSUserNotificationDefaultSoundName | |
def notify(message, title='Notification', sound=False): | |
notification = NSUserNotification.alloc().init() | |
notification.setTitle_(title) | |
notification.setInformativeText_(message) | |
if sound: |
View agtrunc
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
#!/usr/bin/env python | |
'''Truncates matches from ag | |
Place this script somewhere in your $PATH, like ~/bin and pipe ag into it. | |
Vim could be setup like this: | |
if executable('ag') | |
set grepprg=ag\ --vimgrep\ -w\ $* | |
if executable('agtrunc') |
View example.py
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 logging | |
import multiprocessing | |
import time | |
import mplog | |
FORMAT = '%(asctime)s - %(processName)s - %(levelname)s - %(message)s' | |
logging.basicConfig(level=logging.DEBUG, format=FORMAT) | |
existing_logger = logging.getLogger('x') |
View pattern_split.py
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
# coding: utf-8 | |
from __future__ import print_function | |
import re | |
pattern = u''.join([ | |
u'[', | |
u'\u0020-\u002f', # < General Latin characters, exclude @, letters and numbers | |
u'\u003A-\u003f', | |
u'\u005b-\u0060', |
View watchdog_persistent_observer.py
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Subclassing Observer for saving states of folders, and load this states at the next observation. | |
TODO : mapping events and handlers dispatching, for a shorter code. | |
""" | |
from __future__ import unicode_literals, print_function, division | |
import cPickle as pickle | |
import os |
OlderNewer