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
#include <vector> | |
#include <list> | |
#include <map> | |
#include <set> | |
#include <deque> | |
#include <queue> | |
#include <stack> | |
#include <bitset> | |
#include <algorithm> | |
#include <functional> |
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 os, sys | |
class Winpdb(object): | |
'''Embed a Winpdb server. | |
If you have to tunnel to connect remotely from the Winpdb client, run: | |
ssh -C -N -f -L 51000:localhost:51000 $SERVER_HOST |
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 -*- | |
''' | |
Created on 2011-12-17 | |
@author: tianwei | |
''' | |
import os,sys |
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
#it is in the backend package | |
class PreviousURLMiddleware(object): | |
def process_response(self, request, response): | |
if response.status_code == 200: | |
try: | |
request.session["previous_url"] = request.session["current_visiting"] | |
except: | |
pass | |
request.session["current_visiting"] = request.get_full_path() | |
return response |
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 urllib2,base64 | |
url = "http://192.168.2.90:7878/api/users/?format=json" | |
request = urllib2.Request(url) | |
username = "root" | |
password = "root" | |
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '') |
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 django.core.files import File | |
def importFiles(record, preset): | |
ret = {'xml': record[XML], 'pic': record[PIC], 'js': record[JS]} | |
fs = FileStorage() | |
for key, value in ret.items(): | |
if os.path.isfile(value) is True: | |
with File(open(value, 'r')) as f: | |
fs.file_name = os.path.basename(value).split('.')[0] | |
fs.mapping_preset_id = preset |
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
//要找到某条路径,就需要进行二叉树的遍历,在此使用前序遍历: 父节点-> left ->right | |
//Tips: 1. 虽然使用了递归,但是每个结点维护自己的buffer,比较耗空间 | |
void findSum(TreeNode head, int sum, ArrayList<Integer> buffer, int level) | |
//head 是当前树的根节点, sum 是期望的路径和, | |
//buffer 是数组,可以看成stack, 每个结点对应着自己的buffer,值是从根节点按照前序遍历到自己的路径节点, | |
//这也是从其他节点到该节点的有效路径,如果对这个数组进行反向遍历,就得到了从某个结点到该节点的路径 | |
//level 只是为了遍历的时候简单,完全可以用ArrayList的长度,可以去掉这个参数 | |
{ | |
if(head == null) return; // 递归判断,终止条件 | |
int tmp = sum; |
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 threading | |
import time | |
MAX = 8 | |
MIN = 0 | |
TIME_LIMIT = 60 | |
g = 0 |
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
$ git rebase upstream/master | |
First, rewinding head to replay your work on top of it... | |
Applying: config test for dae | |
Using index info to reconstruct a base tree... | |
M apitests/framework.py | |
M tests/test_commodity/framework.py | |
<stdin>:48: trailing whitespace. | |
dae test -p -- ilmen/apitests/ --junitxml=ilmen/reports/apitest_v2/nose.xml --cov=ilmen.view.commodity.api.v2 || RET=$? | |
warning: 1 line adds whitespace errors. | |
Falling back to patching base and 3-way merge... |
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 os | |
from os.path import join, exists, splitext | |
import datetime | |
import uuid | |
import string | |
import random | |
import shutil | |
TEST_DIR = '/tmp/xinxin/' |
OlderNewer