Skip to content

Instantly share code, notes, and snippets.

View magicshui's full-sized avatar

Magicshui magicshui

View GitHub Profile
@magicshui
magicshui / yjpj.js
Created June 3, 2011 12:19
一键完成教学评估
javascript:
// 取消时间限制
parent.bottomFrame.mainFrame.setFlag();
// 勾选所有选项为“优秀”(默认)
for(i=0;i<parent.bottomFrame.mainFrame.document.StDaForm.elements.length;i++)
{
if(parent.bottomFrame.mainFrame.document.StDaForm.elements[i].type=='radio'
&&parent.bottomFrame.mainFrame.document.StDaForm.elements[i].value=='10_1')
{
parent.bottomFrame.mainFrame.document.StDaForm.elements[i].checked=true;
@magicshui
magicshui / cx.aspx
Created June 7, 2011 08:53
cx source code
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="Chaxun._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ScriptManager ID="ScriptManager1" runat="server">
@magicshui
magicshui / joinpptfiles.py
Created December 19, 2011 12:05
join the ppt files into one single ppt file
# put all the files into a folder,and change the path var below
import win32com.client , sys , os , glob
Application = win32com.client.Dispatch("PowerPoint.Application")
Application.Visible = True
new_ppt = Application.Presentations.Add()
path = "C:\\"
os.chdir(path)
for files in glob.glob(os.path.join(path,"*.ppt")):
exit_ppt = Application.Presentations.Open(files)
page_num = exit.Slides.Count
@magicshui
magicshui / move_desktop_to_ddisk.py
Created December 29, 2011 08:29
move the desktop files to D disk
import os,shutil,sys,datetime
org_path=["C:\\Users\\AolneShui\\Desktop"]
des_path=["D:\\MyDesktop\\"+str(datetime.date.today())]
def MoveDirAndFiles(srcPath,dstPath):
allChangeFileList=os.listdir(srcPath)
for changeFileItem in allChangeFileList:
changeFilePath=os.path.join(srcPath,changeFileItem)
if(os.path.isdir(changeFilePath)):
dstAddPath=os.path.join(dstPath,changeFileItem)
@magicshui
magicshui / cx.aspx
Created March 12, 2012 01:55
成绩查询
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="Chaxun._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ScriptManager ID="ScriptManager1" runat="server">
#import <Cocoa/Cocoa.h>
#import "CaculatorBrain.h"
@interface CaculatorBrainAppDelegate : NSObject <NSApplicationDelegate>
// the outlet of the label
@property (weak) IBOutlet NSTextFieldCell *display;
@property (assign) IBOutlet NSWindow *window;
NSMutableURLRequest *request;
NSError *error;
NSURLResponse* response;
NSData *receivedData;
NSString*result;
static NSString* url_pic =@"http://douban.fm/misc/captcha?size=m&id=";
request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:url_fav_song]];
[request setValue:@"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" forHTTPHeaderField:@"Accept"];
[request setValue:@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0" forHTTPHeaderField:@"User-Agent"];
receivedData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
@magicshui
magicshui / gist:3150835
Created July 20, 2012 13:49
河北大学校外查成绩的原理

##前言 什么是自由?自由不是想做什么都能做什么,而是当你不想做什么的时候可以选择不做。 ##正题 其实你知道,所有的成绩都是以数据的形式存放在学校的数据库中,而学校通过IP显示、网络端口的限制等一系列手段来保证数据的安全,当然,这些做法是无可厚非的,但是你不然学生查到自己的成绩就有点……

首先看下学校的查成绩方式:

  1. 登陆学校的教务系统。在这一次的登陆中,你会输入用户名、密码,学校的后台程序在接收到你的登陆请求以后就会验证,通过验证则会在本地保存一个cookie,在服务器端维护一个session。这些是你已经登陆的证明。

  2. 点击查成绩。学校的教务系统使用的iframe的嵌入方式,也就是说他其实就是外边一个框,当你点击里面链接的时候只变换里面的内容。但是你会发现这样页面的url地址并没有变化,然后就有异步刷新的假象……额,这种方式多年以前很流行,我只能这样说

@magicshui
magicshui / gmimap.py
Created September 26, 2012 13:23 — forked from davesteele/gmimap.py
Class and example for using the Gmail IMAP Extensions
#!/usr/bin/python -tt
""" Example of how to use Google IMAP Extensions using Python
http://code.google.com/apis/gmail/imap/
"""
import imaplib
import re
class GmailIMAP4_SSL( imaplib.IMAP4_SSL ):