在Gui和Cui之间切换
六月 23rd, 2008
Linux 在nautilus和term间
习惯用图形界面浏览文件,但很工作要在终端下才能做,于是要不停的切换。
xterm下”nautilus .”直接以当前目录打开nautilus。
~/.gnome2/nautilus-scripts文件夹下面新建一个名为term的文件,内容为 :
#!/bin/bash
gnome-terminal
chmod a+x term加上可执行权限。
然后在Nautilus中就可以通过右键,Scripts,term打开一个当前目录的term。
http://g-scripts.sourceforge.net/
Windows在explorer和cmd之间
cmd下”explorer .”直接以当前目录打开explorer。
文件夹右键打开cmd。
可以装微软powertoys里的cmdhere(不支持windows 2003)
也可以把以下代码保存为cmdhere.reg,双击导入注册表。
REGEDIT4
[HKEY_CLASSES_ROOT\*\shell\cmdhere]
@=”Cmd&Here”
[HKEY_CLASSES_ROOT\*\shell\cmdhere\command]
@=”cmd.exe /c start cmd.exe /k pushd \”%L\\..\”"
[HKEY_CLASSES_ROOT\Folder\shell\cmdhere]
@=”Cmd&Here”
[HKEY_CLASSES_ROOT\Folder\shell\cmdhere\command]
@=”cmd.exe /c start cmd.exe /k pushd \”%L\”"
两个登录网关和设置IE代理的VBS脚本
六月 17th, 2008
因为学校网络的特殊性,经常要登录学校网关和切换浏览器代理不胜其烦,Google了一下也没有更好的办法就自己写了两个VBS的脚本。
rem 开启IE代理
Set WshShell = WScript.CreateObject(”WScript.Shell”)
WshShell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable”, 1 ,”REG_DWORD”
rem 关闭IE代理
Set WshShell = WScript.CreateObject(”WScript.Shell”)
WshShell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable”, 0 ,”REG_DWORD”
Regmon一下就可以发现,设置IE代理的时候就是在改ProxyEnable这个键值,只是手动设置的时候IE可以立即更新代理设置,这种方法只能在新开一个IE后才能有效。FireFox的话可以装一个QuickProxy。
登录网关脚本
Dim WinHttpReq
Set WinHttpReq = CreateObject(”WinHttp.WinHttpRequest.5.1″)
WinHttpReq.Open “POST”, “http://nic.bjut.edu.cn/”,False
WinHttpReq.Send “DDDDD=myid&upass=mypass&0MKKey=%C1%AC%BD%D3%CD%F8%C2%E7″
‘~ Wscript.Echo WinHttpReq.ResponseText
退出脚本
Dim WinHttpReq
Set WinHttpReq = CreateObject(”WinHttp.WinHttpRequest.5.1″)
WinHttpReq.Open “GET”, “http://nic.bjut.edu.cn/F.htm”,False
WinHttpReq.Send
‘~ Wscript.Echo WinHttpReq.ResponseText
其实就模拟了一下浏览器的行为,比较BS的是帐号密码都没有加密就发送了,MKKey那一长串值不知是何意,我是直接从Wireshark捕捉的包里拷出来的,我的Fiddler一打开系统就僵死掉了,所以只能用这个大家伙了。
ruby版 for Linux
require ‘net/http’
h = Net::HTTP.new(’nic.bjut.edu.cn’, 80)
h.post(’/',’DDDDD=s2007xxx&upass=520xxx&0MKKey=%C1%AC%BD%D3%CD%F8%C2%E7′)
require ‘net/http’
h = Net::HTTP.new(’nic.bjut.edu.cn’, 80)
h.get(’/F.htm’)