2014年10月30日星期四

如何用cmd转换mbr分区为gpt分区

>diskpart
>list disk # 列出所有磁盘,在gpt一栏下有星号即为gpt分区
>select disk * # *代表所选磁盘的序号
>convert gpt # 转换为gpt分区

从crxMouse迁移到gestures for chrome,保留crxMouse操作习惯的配置文件

{
  "name": "Chrome Gestures",
  "version": "1.13.4",
  "normal_actions": {
    "L": {
      "name": "back",
      "args": []
    },
    "R": {
      "name": "forward",
      "args": []
    },
    "UD": {
      "name": "reload",
      "args": []
    },
    "UDU": {
      "name": "cacheless reload",
      "args": []
    },
    "D": {
      "name": "scroll up",
      "args": []
    },
    "DR": {
      "name": "close this tab",
      "args": []
    },
    "#FlipBack": {
      "name": "back",
      "args": []
    },
    "#FlipForward": {
      "name": "forward",
      "args": []
    },
    "U": {
      "name": "scroll up",
      "args": []
    },
    "UL": {
      "name": "select left tab",
      "args": []
    },
    "UR": {
      "name": "select right tab",
      "args": []
    },
    "RD": {
      "name": "scroll to bottom",
      "args": []
    },
    "RU": {
      "name": "scroll to top",
      "args": []
    },
    "DL": {
      "name": "re-open closed tab",
      "args": []
    },
    "DRU": {
      "name": "open new tab",
      "args": []
    },
    "LU": {
      "name": "pin this tab",
      "args": []
    },
    "LD": {
      "name": "unpin this tab",
      "args": []
    }
  },
  "linkdrag_actions": {
    "D": {
      "name": "copy text",
      "args": []
    },
    "U": {
      "name": "copy url",
      "args": []
    },
    "L": {
      "name": "open in background tab",
      "args": []
    },
    "R": {
      "name": "open in new tab",
      "args": []
    },
    "UD": {
      "name": "Clipboard::copy url and text",
      "args": []
    }
  },
  "textdrag_actions": {
    "L": {
      "name": "search with #1 in background tab",
      "args": [
        "http://www.google.com/search?q=%s",
        "Google"
      ]
    },
    "R": {
      "name": "search with #1 in background tab",
      "args": [
        "http://www.baidu.com/s?wd=%s",
        "Baidu"
      ]
    },
    "U": {
      "name": "search with #1 in background tab",
      "args": [
        "http://dict.youdao.com/search?q=%s",
        "Youdao"
      ]
    },
    "D": {
      "name": "copy text",
      "args": []
    }
  },
  "mouse_track": true,
  "visualized_arrow": true,
  "superdrag": true,
  "useMousewheel": false,
  "useTabList": false,
  "useSmoothScroll": false,
  "ScrollSpeedValue": 0.2,
  "useScrollAcceleration": false,
  "AccelerationValue": 5,
  "suppress_contextmenu": true,
  "minimumUnit": 10
}

在Advanced里面用Import Configuration导入即可,话说crxMouse作者别有用心,这不得不让我对那些非开源和非google官方的扩展感到恐惧
现在Chrome上面其他常用高权限扩展:
 右键搜,不过这货是开源软件,而且作者貌似放弃开发了;
 有道云笔记 必须弃用,开始向evernote和google keep迁移了;
 any.do 有bug,每次重新打开chrome就要重新登陆,弃用;
 一键管理 感觉这个扩展很好用,暂时先留着吧,其实如果extensions可以按照是否启用排序就好了;
 迅雷、QQ旋风-链接自动转换 喔,这个扩展是所有里面最高权限的,不但具有读取权限,还可以修改,禁用;
 微度新标签页(APP) 这个也在寻找替代品当中;
 Adblock 留。


顺便保留一下crxMouse的修改方法:
删除或改名扩展目录下的tr_advanced.jstr_simple.js这两个文件,偷隐私的代码似乎都在这两个文件中,而且这个公司给所有购买后的扩展加入的代码都是一样的,就是这两个文件,另外顺手把扩展目录下的ga.js文件也删除或改名,ga.js文件中是利用google统计的代码,应该也是这公司加的。
转自卡饭论坛http://bbs.kafan.cn/thread-1693616-1-1.html
配置文件:
{
  "cfgver": 2.3,
  "drag": {
    "ddirect": true,
    "ddirectcolor": "5E6A88",
    "ddirectopa": 0.9,
    "dholdkey": "none",
    "dragimage": true,
    "draginput": false,
    "draglink": true,
    "dragtext": true,
    "dragui": true,
    "dstroke": true,
    "dstrokecolor": "4E1485",
    "dstrokeopa": 0.8,
    "dstrokewidth": 5,
    "dtooltip": true,
    "dtooltipcolor": "120310",
    "dtooltipopa": 0.9,
    "dtooltipwidth": 18,
    "image": [
      {
        "action": "I_open",
        "direct": "L",
        "moreDes": "打开图片(新标签页,后台)",
        "morePinned": "unpinned",
        "morePosition": "chrome",
        "moreTarget": "newback"
      },
      {
        "action": "I_open",
        "direct": "R",
        "moreDes": "打开图片(新标签页,前台)",
        "morePinned": "unpinned",
        "morePosition": "chrome",
        "moreTarget": "newfront"
      },
      {
        "action": "I_save",
        "direct": "D"
      }
    ],
    "imgfirst": "none",
    "imgfirstcheck": false,
    "link": [
      {
        "action": "L_open",
        "direct": "L",
        "moreDes": "打开链接(新标签页,后台)",
        "morePinned": "unpinned",
        "morePosition": "chrome",
        "moreTarget": "newback"
      },
      {
        "action": "L_open",
        "direct": "R",
        "moreDes": "打开链接(新标签页,前台)",
        "morePinned": "unpinned",
        "morePosition": "chrome",
        "moreTarget": "newfront"
      },
      {
        "action": "L_copytext",
        "direct": "D"
      },
      {
        "action": "L_copyurl",
        "direct": "U"
      }
    ],
    "setdragurl": true,
    "text": [
      {
        "action": "T_search",
        "direct": "L",
        "moreDes": "使用%name搜索:\"%s\"(新标签页,后台)",
        "morePinned": "unpinned",
        "morePosition": "chrome",
        "moreTarget": "newback",
        "moreTsearch": "sgoogle"
      },
      {
        "action": "T_search",
        "direct": "R",
        "moreDes": "使用%name搜索:\"%s\"(新标签页,前台)",
        "morePinned": "unpinned",
        "morePosition": "chrome",
        "moreTarget": "newfront",
        "moreTsearch": "sgoogle"
      },
      {
        "action": "T_copytext",
        "direct": "D"
      },
      {
        "direct": "U",
        "action": "T_searchuser",
        "moreName": "有道词典",
        "moreURL": "http://dict.youdao.com/search?q=%s",
        "moreDes": "使用%name搜索:\"%s\"",
        "moreTarget": "newback",
        "morePosition": "chrome",
        "morePinned": "unpinned"
      }
    ]
  },
  "gesture": {
    "direct": true,
    "directcolor": "5E6A88",
    "directopa": 0.9,
    "geskey": "right",
    "gesture": [
      {
        "action": "G_back",
        "direct": "L"
      },
      {
        "action": "G_go",
        "direct": "R"
      },
      {
        "action": "G_up",
        "direct": "U"
      },
      {
        "action": "G_down",
        "direct": "D"
      },
      {
        "action": "G_close",
        "direct": "DR",
        "moreCloseopts": "close",
        "moreClosesel": "chrome",
        "moreCloseurl": "chrome://newtab/"
      },
      {
        "direct": "LU",
        "action": "G_pin"
      },
      {
        "action": "G_bottom",
        "direct": "RD"
      },
      {
        "action": "G_top",
        "direct": "RU"
      },
      {
        "action": "G_reload",
        "direct": "UD"
      },
      {
        "action": "G_reloadclear",
        "direct": "UDU"
      },
      {
        "action": "G_lefttab",
        "direct": "UL"
      },
      {
        "action": "G_righttab",
        "direct": "UR"
      },
      {
        "action": "G_newwindow",
        "direct": "DRU"
      },
      {
        "action": "G_closewindow",
        "direct": "URD"
      },
      {
        "action": "G_crxsettings",
        "direct": "RDLU",
        "moreDes": "进入扩展设置页",
        "morePinned": "unpinned",
        "morePosition": "chrome",
        "moreTarget": "newfront"
      },
      {
        "direct": "LD",
        "action": "G_movetowindow"
      },
      {
        "direct": "DL",
        "action": "G_reclosedtab",
        "moreDes": "重新打开关闭的标签页",
        "moreTarget": "newfront",
        "morePosition": "chrome",
        "morePinned": "unpinned"
      }
    ],
    "gestureui": true,
    "gholdkey": "none",
    "stenable": false,
    "stroke": true,
    "strokecolor": "4E1485",
    "strokeopa": 0.8,
    "strokewidth": 5,
    "tooltip": true,
    "tooltipcolor": "120310",
    "tooltipopa": 0.9,
    "tooltipwidth": 18
  },
  "normal": {
    "autocancel": false,
    "autocancelvalue": 2,
    "cancelcontextmenu": true,
    "capturetype": "jpeg",
    "dbclicktime": 600,
    "drag": true,
    "gesture": true,
    "jpegquality": 100,
    "lasttab": false,
    "minilength": 10,
    "newtabposition": "chrome",
    "scroll": false,
    "scrolleffects": true
  },
  "others": {
    "tuilink": false
  },
  "scroll": {
    "scrollaccele": 1,
    "scrollspeed": 3,
    "smooth": true
  },
  "scrollgesture": {
    "sgsleft": [
      {
        "action": "G_top"
      },
      {
        "action": "G_bottom"
      }
    ],
    "sgsleftenable": true,
    "sgsright": [
      {
        "action": "G_top"
      },
      {
        "action": "G_bottom"
      }
    ],
    "sgsrightenable": false,
    "tablist": true,
    "tablistkey": "right"
  },
  "strokegesture": {
    "strleft": [
      {
        "action": "G_none"
      },
      {
        "action": "G_righttab"
      }
    ],
    "strleftenable": true,
    "strmiddle": [
      {
        "action": "G_lefttab"
      },
      {
        "action": "G_righttab"
      }
    ],
    "strmiddleenable": false,
    "strpress": "up",
    "strright": [
      {
        "action": "G_lefttab"
      },
      {
        "action": "G_none"
      }
    ],
    "strrightenable": true
  },
  "sync": true
}

2014年10月28日星期二

Symbol in Python

Keywords
KEYWORD
DESCRIPTION
EXAMPLE
and
Logical and.
True and False == False
as
Part of the with-as statement.
with X as Y: pass
assert
Assert (ensure) that something is true.
assert False, "Error!"
break
Stop this loop right now.
while True: break
class
Define a class.
class Person(object)
continue
Don't process more of the loop, do it again.
while True: continue
def
Define a function.
def X(): pass
del
Delete from dictionary.
del X[Y]
elif
Else if condition.
if: X; elif: Y; else: J
else
Else condition.
if: X; elif: Y; else: J
except
If an exception happens, do this.
except ValueError, e: print e
exec
Run a string as Python.
exec 'print "hello"'
finally
Exceptions or not, finally do this no matter what.
finally: pass
for
Loop over a collection of things.
for X in Y: pass
from
Importing specific parts of a module.
import X from Y
global
Declare that you want a global variable.
global X
if
If condition.
if: X; elif: Y; else: J
import
Import a module into this one to use.
import os
in
Part of for-loops. Also a test of X in Y.
for X in Y: pass also 1 in [1] == True
is
Like == to test equality.
1 is 1 == True
lambda
Create a short anonymous function.
s = lambda y: y ** y; s(3)
not
Logical not.
not True == False
or
Logical or.
True or False == True
pass
This block is empty.
def empty(): pass
print
Print this string.
print 'this string'
raise
Raise an exception when things go wrong.
raise ValueError("No")
return
Exit the function with a return value.
def X(): return Y
try
Try this block, and if exception, go to except.
try: pass
while
While loop.
while X: pass
with
With an expression as a variable do.
with X as Y: pass
yield
Pause here and return to caller.
def X(): yield Y; X().next()
Data Types
For data types, write out what makes up each one. For example, with strings write out how you create a string. For numbers write out a few numbers.
TYPE
DESCRIPTION
EXAMPLE
True
True boolean value.
True or False == True
False
False boolean value.
False and True == False
None
Represents "nothing" or "no value".
x = None
strings
Stores textual information.
x = "hello"
numbers
Stores integers.
i = 100
floats
Stores decimals.
i = 10.389
lists
Stores a list of things.
j = [1,2,3,4]
dicts
Stores a key=value mapping of things.
e = {'x': 1, 'y': 2}
String Escape Sequences
For string escape sequences, use them in strings to make sure they do what you think they do.
ESCAPE
DESCRIPTION
\\
Backslash
\'
Single-quote
\"
Double-quote
\a
Bell
\b
Backspace
\f
Formfeed
\n
Newline
\r
Carriage
\t
Tab
\v
Vertical tab
String Formats
Same thing for string formats: use them in some strings to know what they do.
ESCAPE
DESCRIPTION
EXAMPLE
%d
Decimal integers (not floating point).
"%d" % 45 == '45'
%i
Same as %d.
"%i" % 45 == '45'
%o
Octal number.
"%o" % 1000 == '1750'
%u
Unsigned decimal.
"%u" % -1000 == '-1000'
%x
Hexadecimal lowercase.
"%x" % 1000 == '3e8'
%X
Hexadecimal uppercase.
"%X" % 1000 == '3E8'
%e
Exponential notation, lowercase 'e'.
"%e" % 1000 == '1.000000e+03'
%E
Exponential notation, uppercase 'E'.
"%E" % 1000 == '1.000000E+03'
%f
Floating point real number.
"%f" % 10.34 == '10.340000'
%F
Same as %f.
"%F" % 10.34 == '10.340000'
%g
Either %f or %e, whichever is shorter.
"%g" % 10.34 == '10.34'
%G
Same as %g but uppercase.
"%G" % 10.34 == '10.34'
%c
Character format.
"%c" % 34 == '"'
%r
Repr format (debugging format).
"%r" % int == "<type 'int'>"
%s
String format.
"%s there" % 'hi' == 'hi there'
%%
A percent sign.
"%g%%" % 10.34 == '10.34%'
Operators
Some of these may be unfamiliar to you, but look them up anyway. Find out what they do, and if you still can't figure it out, save it for later.
OPERATOR
DESCRIPTION
EXAMPLE
+
Addition
2 + 4 == 6
-
Subtraction
2 - 4 == -2
*
Multiplication
2 * 4 == 8
**
Power of
2 ** 4 == 16
/
Division
2 / 4.0 == 0.5
//
Floor division
2 / 4.0 == 0.0
%
String interpolate or modulus
2 % 4 == 2
<
Less than
4 < 4 == False
>
Greater than
4 > 4 == False
<=
Less than equal
4 <= 4 == True
>=
Greater than equal
4 >= 4 == True
==
Equal
4 == 5 == False
!=
Not equal
4 != 5 == True
<>
Not equal
4 <> 5 == True
( )
Parenthesis
len('hi') == 2
[ ]
List brackets
[1,3,4]
{ }
Dict curly braces
{'x': 5, 'y': 10}
@
At (decorators)
@classmethod
,
Comma
range(0, 10)
:
Colon
def X():
.
Dot
self.x = 10
=
Assign equal
x = 10
;
semi-colon
print "hi"; print "there"
+=
Add and assign
x = 1; x += 2
-=
Subtract and assign
x = 1; x -= 2
*=
Multiply and assign
x = 1; x *= 2
/=
Divide and assign
x = 1; x /= 2
//=
Floor divide and assign
x = 1; x //= 2
%=
Modulus assign
x = 1; x %= 2
**=
Power assign
x = 1; x **= 2