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
$ virtualenv env [21:30:32] | |
New python executable in env/bin/python | |
Installing setuptools................................... | |
Complete output from command /tmp/env/bin/python -c "#!python | |
\"\"\"Bootstra...sys.argv[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
// ==UserScript== | |
// @name hack_zf | |
// @namespace https://gist.github.com/jyjmrlk/8018695#file-hack_zf-js | |
// @version 0.1 | |
// @description hack zhengfang review. | |
// @include http://202.119.248.199/xsjxpj.aspx* | |
// @copyright 2013+, 正吉熊Gimo | |
// ==/UserScript== | |
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
/* | |
The purpose of this function is to convert an unsigned | |
binary number to reflected binary Gray code. | |
The operator >> is shift right. The operator ^ is exclusive or. | |
*/ | |
unsigned int binaryToGray(unsigned int num) | |
{ | |
return (num >> 1) ^ num; | |
} |
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 Solution { | |
public: | |
int singleNumber(int A[], int n) { | |
int x = 0; | |
for(int i = 0;i<n;i++){ | |
x ^= A[i]; | |
} | |
return x; | |
} | |
}; |
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
tags = db.Table('tags', | |
db.Column('tag_id', db.Integer, db.ForeignKey('tag.id')), | |
db.Column('page_id', db.Integer, db.ForeignKey('page.id')) | |
) | |
class Page(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
tags = db.relationship('Tag', secondary=tags, | |
backref=db.backref('pages', lazy='dynamic')) |
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 | |
# -*- encoding: utf-8 -*- | |
from libs.pprint import pprint | |
from libs.base_handler import * | |
import json | |
class Handler(BaseHandler): | |
''' | |
this is a sample handler |
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, json | |
print '\n'.join([' '.join((jogo['home_team']['country'], str(jogo['home_team']['goals']), 'x', jogo['away_team']['country'], str(jogo['away_team']['goals']))) for jogo in json.loads(urllib2.urlopen('http://worldcup.sfg.io/matches').read().decode('utf-8')) if jogo['status'] == 'completed']) |
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:utf8 | |
import random,threading,time | |
from Queue import Queue | |
#Producer thread | |
class Producer(threading.Thread): | |
def __init__(self, t_name, queue): | |
threading.Thread.__init__(self,name=t_name) | |
self.data=queue | |
def run(self): |
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=utf8 | |
#!/usr/bin/python | |
import csv | |
import sys | |
PATHS = ('/Users/Gimo/Desktop/1.csv', | |
'/Users/Gimo/Desktop/2.csv', | |
'/Users/Gimo/Desktop/3.csv', | |
'/Users/Gimo/Desktop/4.csv', | |
'/Users/Gimo/Desktop/5.csv' |
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
// ==UserScript== | |
// @name online_GPA | |
// @version 0.1 | |
// @description show GPA online. | |
// @include http://202.119.248.199/xscjcx_dq.aspx?xh=* | |
// @copyright 2014+, Gimo | |
// ==/UserScript== | |
function get_point(str){ | |
if(str=="优秀") return 4.5; |
OlderNewer