Skip to content

Instantly share code, notes, and snippets.

M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@HQMIS
HQMIS / gist:6760305
Created September 30, 2013 07:13
method of change apache's DirectoryIndex
http://www.cnblogs.com/elfsundae/archive/2010/12/14/1905942.html
@HQMIS
HQMIS / gist:6416662
Last active December 22, 2015 04:19
mysql
backup: http://hi.baidu.com/setcookie/item/5a5352f99df32217cf9f326f
modify pwd
>/etc/init.d/mysql stop
>>/usr/bin/mysqld_safe --skip-grant-tables &
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges
>/etc/init.d/mysql start
@HQMIS
HQMIS / gist:6279161
Created August 20, 2013 09:16
中文Cookie问题
window.onload = function (){
var arrStr = document.cookie.split(";");
for(var i=0; i<arrStr.length; i++){
var temp = arrStr[i].split("=");
if(temp[0].trim()=="username"){
var usr = temp[1].trim();
alert(usr);
alert(typeof(usr));
var test = "\345\220\257\346\225\217";
alert(test);
@HQMIS
HQMIS / gist:5736343
Created June 8, 2013 19:39
push to more than one git
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "all"]
url = [email protected]:HQMIS/ITGPS.git
@HQMIS
HQMIS / gist:5075063
Created March 3, 2013 07:02
BYHHAutoRe's Crash
File "E:\GitHub\BYHHAutoRe\byhh.py", line 146, in reply
return self.reply(url, cookie)
File "E:\GitHub\BYHHAutoRe\byhh.py", line 146, in reply
return self.reply(url, cookie)
File "E:\GitHub\BYHHAutoRe\byhh.py", line 146, in reply
return self.reply(url, cookie)
File "E:\GitHub\BYHHAutoRe\byhh.py", line 146, in reply
return self.reply(url, cookie)
RuntimeError: maximum recursion depth exceeded
@HQMIS
HQMIS / gist:4961893
Last active December 13, 2015 19:19
pythonchallenge
0 --> Hint: try to change the URL address. (http://www.pythonchallenge.com/pc/def/0.html --> http://www.pythonchallenge.com/pc/def/1.html)
1 --> calculate 2**38 (http://www.pythonchallenge.com/pc/def/1.html --> http://www.pythonchallenge.com/pc/def/274877906944.html)
C:\Documents and Settings\huangqimin>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> 2**38
@HQMIS
HQMIS / gist:4666252
Created January 29, 2013 18:07
【Python】【Library】【pep8】
http://pypi.python.org/pypi/pep8/1.4.1
@HQMIS
HQMIS / gist:4666243
Created January 29, 2013 18:06
在线IDE
http://www.trypython.org/
http://codepad.org/
@HQMIS
HQMIS / gist:4530040
Created January 14, 2013 13:23
mark
http://i.youku.com/u/UMTc0ODYxNDcy