How to wake up your computer on the LAN?
the answer is just to send a Magic Packet to your computer on port 7 or 9.
However when your computer is down, it has no ip, so send it to the broadcast ip
the following python script implements the above idea.
import struct, socket
def wake_on_lan(ether_addr, inet_addr):
addr_byte=ether_addr.split(’:')
[...]
opensource's archives
wake-on-lan by python script
统一Mac OS X,Windows XP/Vista以及linux的系统时间
Windows把BIOS时间作为系统时间,而Mac OS X把BIOS时间作为GMT+0时间,所以对于生活在GMT+8时区的中国用户来说,这两个系统共存时系统时间是不一致的。即:如果windows时间为12:00,则到Mac OS X下就变成了20:00,在Mac OS X下改过来后,再回到windows下就又错了。
之前看过这篇blog,讲了通过修改windows注册表,使得windows也把bios时间作为GMT+0时间,这样就可以解决这个问题了,具体操作如下:在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\中加一项DWORD,RealTimeIsUniversal,把值设为1即可。
这个办法是靠调整windows时间设置来解决问题的,但是当系统中有linux时,因为linux也是使用bios时间作为系统时间,所以这时linux系统的时间就又不一致了。最好的办法就是调整Mac OS X的时间。于是想到了强大的Bash Shell,先写脚本1用来开机时自动把时间校对准,然后关机时再运行脚本2,把时间调整回去。脚本1:#!/bin/bashd=$(date "+%d")H=$(date "+%H")M=$(date "+%M")S=$(date "+%S")let "H=$H-16"
z=0if [ "$H" -lt "$z" ]then let "H=$H+24" let "d=$d-1" fi
z=10
if [ "$d" -lt "$z" ]then d=0$d fi
if [ "$H" -lt "$z" ]then H=0$H fi
sudo date -u $d$H$M.$S
脚本2#!/bin/bashss=$(date "+%d%H%M.%S")sudo date -u $ss
那么如何实现自动开机运行以及关机自动运行呢?1 开机自动运行写shell,然后在applescript中调用shell,再把applescript保存为app,添加到login items中注:我的.sh文件和textmate做绑定了,这样直接添加.sh文件不会执行shell,而是被textmate打开
2 关机自动运行使用launchbar的restart和shutdown applescript,因此只需在这两个script中添加调用shell的一句即可了。
bash shell修改系统时间需要root权限,那么如何在applescript中调用时输入root密码呢?使用如下命令:do shell script [...]
Continue reading " 统一Mac OS X,Windows XP/Vista以及linux的系统时间 "
vi commands
from http://www.colorado.edu/ITS/docs/unix/vi.html
Window motions
<CTRL>d — Scroll down (half a screen)<CTRL> — Scroll up (half a screen)<CTRL>f — Page forward<CTRL>b — Page backward/string — Search forward?string — Search backwardn — Repeat searchN — Repeat search reverseG — Go to last linenG — Go to line n :n — Go to line n<CTRL>l — Redraw screen<CTRL>g — File [...]
Search
Most Comments
- blogsync with gui coming, import your wordpress to blogger (69)
- blogsync 0.3 released, comments can be imported. (22)
- A tool that import all posts from wordpress to blogger in python (8)
- Mac OS X上成功使用dopod 696 wm5.0 连 cmwap上网 (7)
- blogsync 2.0 released, import your wordpress to blogger from rss xml file or online (5)
- How to decompile .dex file on Android (4)
- Inconvenienced when using Contact Content Provider on Android (3)
- 统一Mac OS X,Windows XP/Vista以及linux的系统时间 (2)
- Windows XP/Vista vs Mac OS X 软件对比清单 (2)
- 性能准则之一:在遍历集合前一定要判断集合是否为空 (2)
- A python script that get posts from wordpress by httplib (1)
- blogsync FAQ (1)
Recent Comments
- Naveen chenoli in blogsync with gui coming, import yo…
- snupijenta in blogsync 0.3 released, comments can…
- Cristian in blogsync 0.3 released, comments can…
- Maypu in 说个有趣的事儿,钥匙与ha…
- Maypu in 看图说话,谈谈adapter,prox…
- zeaster in blogsync 0.3 released, comments can…
- the writer in blogsync 0.3 released, comments can…
- zeaster in Inconvenienced when using Contact C…
- sshwsfc in Inconvenienced when using Contact C…
- zeaster - How t… in Inconvenienced when using Contact C…