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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style> | |
.config{width:250px;margin: 40px auto;} | |
.grid{display:none;border-collapse:collapse; margin:30px auto 0 auto;} | |
.grid td{width:50px; height:50px; text-align:center; vertical-align:middle;} | |
.choice{display:inline-block;width:100px;} |
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
>>> class Case(object): | |
... a = [] | |
... def show_attribute(self): | |
... print self.a | |
>>> Case.a | |
[] | |
>>> case = Case() | |
>>> case.a | |
[] |
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 merge_array(l_array, r_array): | |
merged_array = [] | |
i, j = 0, 0 | |
local_count = 0 | |
while(i < len(l_array) and j < len(r_array)): | |
if l_array[i] > r_array[j]: | |
merged_array.append(r_array[j]) | |
local_count += len(l_array) - i | |
j += 1 | |
else: |
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
/* strtok example */ | |
#include <stdio.h> | |
#include <cstring> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
int main () | |
{ | |
char str[] ="1 1:1 2:2 3:3"; | |
char * pch; |
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/python | |
import usb.core | |
import usb.util | |
import usb.backend.libusb10 | |
import sys, getopt | |
opts = getopt.getopt(sys.argv[1:],'',['off']) | |
off = 'off' in opts[1] |
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
set mouse=a | |
set nu | |
runtime! debian.vim | |
syntax on | |
set background=dark | |
set cursorcolumn | |
set cursorline | |
filetype plugin indent on | |
filetype off | |
" format and user interface |
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
在macbook pro 4核上的测试结果,python自带的map表现比起ipython 的map,list comprehensions都要好。但是有优化的multi_mcpi还是不错。 | |
$ ipcluster start --n=4 | |
print mcpi(100000000) | |
#print multi_mcpi_by_map(dview, 100000000) # 传递太耗时 | |
#print multi_mcpi_by_list_comp(dview, 100000000) | |
#print multi_mcpi(dview, 100000000) | |
$ time py multi_mcpi.py | |
importing random from random on engine(s) |
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
set print pretty on | |
set print object on | |
set print static-members on | |
set print vtbl on | |
set print demangle on | |
set demangle-style gnu-v3 | |
set print sevenbit-strings off | |
python | |
import sys | |
sys.path.insert(0, '/home/ryanhust/ryanlib/python') |
NewerOlder