[闲着没事做]管理员登陆报警器

查MSDN看到的,因为偷懒就不用ctypes了

from Tkinter import *
from ctypes import *
wtsapi = windll('wtsapi32.dll')
user32 = windll('user32.dll')
m_hPrevPorc = 0
hWnd = 0
class App(Frame):
    def __init__(self,master):
        global hWnd
        Frame.__init__(self,master=master)
        self.master.title("BakaBka")
        self.top = self.winfo_toplevel()
        self.master=master
        self.files=[]
        self.master.geometry('%dx%d+%d+%d' % (400,200,50,50))
        self.hwnd = eval(self.master.wm_frame())
        hWnd = self.hwnd
        global m_hPrevPorc
        m_hPrevPorc = user32.SetWindowLongA(self.hwnd,-4,id(WindowProc())) #-4 == #GWL_WNDPROC
        wtsapi.WTSRegisterSessionNotification(self.hwnd,1)##NOTIFY_FOR_ALL_SESSIONS
def WindowProc(hWnd,wMsg,wParam,lParam):
    if(wMsg == 689): #WM_WTSSESSION_CHANGE
        global m_hPrevPorc
        if(wParam == 1):#WTS_CONSOLE_CONNECT
            pass#Command login
        if (wParam == 3):#WTS_REMOTE_CONNECT
            pass#SomeBodyConnect
        if(wParam == 5):#WTS_SESSION_LOGON
            pass#User Login
        if(wParam == 7):#WTS_SESSION_LOCK
            pass#Computer Locking
        if(wParam == 8):#WTS_SESSION_UNLOCK
            pass#Computer unlock
        return(user32.CallWindowProcA(m_hPrevPorc,hWnd,wMsg,wParam,lParam))

if __name__=='__main__':
    root=Tk()
    app=App(root)
    #Entry(root).pack()
    app.mainloop()

明天就得关山里了。27号才放出来。

之后就是新的学期,第二年了,不能像第一年一样了。

然而打算立个计划表,感觉目前没有什么特别想实现的东西。

现在一次一次感觉到了,最可怕的东西不是你不会。而是没有东西能让你提起兴趣去研究。没东西研究所以不能提升自己的技术。

打算复习下世界上最好的语言,接触的比PY早但是用的却比PY少,可能是因为是世界上最好的语言的缘故吧(笑

还有这个代码高亮的bug必须解决一下了,这个玩意因为pjax的缘故一翻页就不会高亮了

Tags: python

[PY]BiliBili-Live直播间录制工具

详情请到Friends下的rabbit的博客查看解析。
由他的影响我也做了一个QWQ,直接上代码辣

import md5,requests,threading,time
_clock_ = 0
times = 0
def _clock():
    global _clock_
    while 1:
        _clock_ = _clock_ + 1
        time.sleep(1)
        print _clock_
        if(_clock_ == times):
            break
def _txt(start_str, end, html):
    start = html.find(start_str)
    if start >= 0:
        start += len(start_str)
        end = html.find(end, start)
        if end >= 0:
            return html[start:end].strip()
def liveURL(url):
    web = requests.get(url)
    ROOMID = 'cid=' + _txt('var ROOMID =',';',web.content)
    appkey = 'appkey=85eb6835b0a1034e'
    ts = 'ts='+str(time.time())
    players = 'player=1'
    quality = 'quality=0'
    m = md5.new()
    m.update(appkey+'&'+ROOMID+'&'+players+'&'+quality+'&'+ts)
    sign = m.hexdigest()
    web = requests.get('http://live.bilibili.com/api/playurl?'+appkey+'&'+ROOMID+'&'+players+'&'+quality+'&'+ts+'&'+sign)
    live_url = _txt('<url><![CDATA[',']]></url>',web.content)
    print live_url
    downLoad(live_url)
def downLoad(url):
    global _clock_,time
    down = requests.get(url)
    with open('D:\\'+str(time.time())+'.flv','wb') as code:
        for data in down.iter_content(chunk_size=4096):
            code.write(data)
            if _clock_ == time:
                break

if __name__ == '__main__':
    url = raw_input("Please Input Bilibili-Live's url:")
    times = int(raw_input("Please Input luzhishijian(i don't know this word for english.QVQ):"))
    t = threading.Thread(target=_clock())
    liveURL(url)
    t.start()
Tags: python, bilibili

【开源】[喜闻乐见的抄袭]易语言仿flask

因为很喜欢Python的flask框架,并且易语言没有开发这类的东西。正巧放假了,于是就打算移(抄)植(袭)一份。

说明我也懒得说明了,这个就当成更新的日志吧。目前进度来看,只是GET,POST访问这些小事情基本是可以处理的了

2016/7/8:乱写的.rar

Tags: none