This file contains hidden or 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 -*- | |
| # The origin C++ code is in http://www.serenethinking.com/2010/08/how-to-create-custom-widgets-with-qt/ | |
| import sys | |
| from PySide.QtCore import Qt | |
| from PySide.QtGui import QLabel | |
| from PySide.QtGui import QPen | |
| from PySide.QtGui import QPainter | |
| from PySide.QtCore import QPoint |
This file contains hidden or 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 -*- | |
| import sys | |
| import os | |
| from twitter import oauth_dance | |
| from twitter import read_token_file | |
| from twitter import OAuth | |
| from twitter import Twitter | |
| # You need to create application in dev.twitter.com. |
This file contains hidden or 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 -*- | |
| """My app""" | |
| import sys | |
| import os | |
| from twitter import oauth_dance | |
| from twitter import read_token_file | |
| from twitter import OAuth | |
| from twitter import Twitter |
This file contains hidden or 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 -*- | |
| """My app""" | |
| import sys | |
| import os | |
| from twitter import oauth_dance | |
| from twitter import read_token_file | |
| from twitter import OAuth | |
| from twitter import Twitter |
This file contains hidden or 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 | |
| source $HOME/.rvm/scripts/rvm | |
| rvm $@ |
This file contains hidden or 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 | |
| if [ -z $1 ]; then | |
| echo "Need commitid." | |
| exit -1 | |
| fi | |
| FILES=`git diff-tree --no-commit-id --name-only -r $1` | |
| OUTPUT='/tmp/git-diff' | |
| mkdir -p $OUTPUT | |
| mkdir -p $OUTPUT/before |
This file contains hidden or 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
| # Python functools.partial example. | |
| from functools import partial | |
| def foo(a, b, c, d): | |
| return a+b+c+d | |
| f1 = partial(foo, 1, 2) | |
| print(f1(3, 4)) | |
| f2 = partial(foo, 1, 2, 3) | |
| print(f2(5)) |
This file contains hidden or 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 foo(a, b, c): | |
| print(a, b, c) | |
| def get_n(): | |
| print("get_n()") | |
| def put_n(): | |
| print("put_n()") | |
| foo.get_n = get_n |
This file contains hidden or 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
| """http://peter-hoffmann.com/2010/extrinsic-visitor-pattern-python-inheritance.html""" | |
| class Node(object): | |
| pass | |
| class A(Node): | |
| pass |
This file contains hidden or 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 <stdio.h> | |
| #include <stdlib.h> | |
| int main(int argc, char* argv[]){ | |
| int row=0, col=0; | |
| int i=0,j=0; | |
| int m=0,n=0; | |
| int tmp=0,sum=0; | |
| float avg=0; | |
| FILE* input=fopen("2d_ary.txt","r"); |