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
{ | |
"10": { | |
"answer": "JSON", | |
"opt": [ | |
"BSON", | |
"JSON", | |
"SON", | |
"XML", | |
"YAML" | |
], |
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
""ubuntu virtual mode ctrl+c 複製到系統剪貼簿 gtk only | |
python import gtk | |
python import vim | |
vmap <silent> <C-C> y:let @0=substitute(@0,"\\","\\\\\\","gi")<CR>:let @0=substitute(@0,"\'","\\\\'","gi")<CR>:python gtk.clipboard_get().set_text('''<C-R>0''')<CR>:python gtk.clipboard_get().store()<CR> |
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
# | |
#Django settings for main project. | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
ADMINS = ( | |
# ('Your Name', '[email protected]'), | |
) |
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
#!/bin/bash | |
### | |
# george.li 2013/1/9 | |
# | |
# simple daemon template | |
# | |
# env var | |
# DAEMON: daemon program path | |
# NAME: suggest daemon name | |
# PID_FILE: daemon pid file path |
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
from bson.objectid import ObjectId | |
from bson.dbref import DBRef | |
from mongoengine.document import Document | |
import collections | |
from datetime import datetime | |
from mongoengine.queryset import QuerySet | |
def raw_data(data): | |
if isinstance(data, unicode): |
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
def json_api(func): | |
def deco(*args, **kwargs): | |
result = {} | |
try: | |
result['status'] = 0 | |
result['msg'] = "success" | |
result['data'] = func(*args, **kwargs) | |
except Exception,e: | |
result['status'] = e.errorno if hasattr(e, 'errorno') else 1 |
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
"height ligth cusor | |
set t_Co=256 | |
set cursorline | |
set cursorcolumn | |
highlight CursorColumn cterm=none ctermbg=236 | |
highlight CursorLine cterm=none ctermbg=236 | |
highlight ColorColumn ctermbg=none ctermbg=240 | |
" Dim inactive windows using 'colorcolumn' setting | |
" This tends to slow down redrawing, but is very useful. |
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
class FormForAdvancedSearch(forms.Form): | |
#you can put any field here this is an example so only 1 simple CharField | |
form_field1 = forms.CharField() | |
class MyModelAdmin(admin.ModelAdmin): | |
# the auxiliary search form | |
advanced_search_form = FormForAdvancedSearch() | |
# a dictionary of key that will be removed from the GET QueryDict | |
# this is necessary otherwise ChangeList will complain for malformed | |
# query string |
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
pp='ps -aux|grep ' | |
function pk(){ | |
echo kill -9 `ps -aux|grep $1|awk '{print \$2}'` | |
} |
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 -*- | |
# | |
# Copyright © 2013 george | |
# | |
# Distributed under terms of the MIT license. | |
__all__=[] | |
import os | |
import sys | |
import re |
OlderNewer