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
copyToClipboard = function(txt) { | |
if(window.clipboardData) { | |
window.clipboardData.clearData(); | |
window.clipboardData.setData(”Text”, txt); | |
} else if(navigator.userAgent.indexOf(”Opera”) != -1) { | |
window.location = txt; | |
} else if (window.netscape) { | |
try { | |
netscape.security.PrivilegeManager.enablePrivilege(”UniversalXPConnect”); | |
} catch (e) { |
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 sys | |
print 'Dive in' | |
saveout = sys.stdout | |
fsock = open('out.log', 'w') | |
sys.stdout = fsock | |
print 'This message will be logged instead of displayed' | |
sys.stdout = saveout | |
fsock.close() |
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 | |
import random | |
import multiprocessing | |
from multiprocessing import Process | |
class MapReduce(object): | |
def __init__(self, map_func, reduce_func, workers_num=None): | |
self.map_func = map_func |
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 flask import Flask, request, jsonify, abort, make_response | |
app = Flask(__name__) | |
tasks = [ | |
{ | |
'id': 1, | |
'title': u'Buy groceries', | |
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol', |
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
tar -cv ORIG_FILE | docker exec -i 42web tar x -C TARGET_DIR |
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 replace_words(text, word_dic): | |
yo = re.compile('|'.join(map(re.escape, word_dic))) | |
def translate(mat): | |
return word_dic[mat.group(0)] | |
return yo.sub(translate, text) |
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: NotoSansHans-Light, AvenirNext-Regular, proxima-nova, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', 'Open Sans', 'Helvetica Neue', Arial, sans-serif; | |
font-family: Helvetica, Tahoma, Arial, STXihei, "华文细黑", "Microsoft YaHei", "微软雅黑", SimSun, "宋体", Heiti, "黑体", sans-serif; | |
} |
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 Pipe(object): | |
def __init__(self, func): | |
self.func = func | |
def __ror__(self, other): | |
def generator(): | |
for obj in other: | |
if obj is not None: | |
yield self.func(obj) | |
return generator() |
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
cat localhost.access_log* |awk '{print $1 " " substr($4,14,5)}'|sort -n|uniq -c|sort -nr|head -20 |
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
<a href="https://plus.google.com/hangouts/_?gid=gh-windrunner-info" style="text-decoration:none;"> | |
<img src="https://ssl.gstatic.com/s2/oz/images/stars/hangout/1/gplus-hangout-24x100-normal.png" | |
alt="Start a Hangout" | |
style="border:0;width:100px;height:24px;"/> | |
</a> |
OlderNewer