#!/usr/bin/env python # Chapter 1 - Download Example - download.py import urllib, sys f = urllib.urlopen(sys.argv[1]) while 1: buf = f.read(2048) if not len(buf): break sys.stdout.write(buf)
Archive for February, 2016
Python网络编程基础 download.py
Wednesday, February 24th, 2016Python网络编程基础 urlclient.py
Wednesday, February 24th, 2016#!/usr/bin/env python # High-Level Gopher Client with urllib - Chapter 1 - urlclient.py import urllib, sys host = sys.argv[1] file = sys.argv[2] f = urllib.urlopen('gopher://%s%s' % (host, file)) for line in f.readlines(): sys.stdout.write(line)
Python网络编程基础 server.py
Wednesday, February 24th, 2016#!/usr/bin/env python # Simple Server - Chapter 1 -server.py import socket host = '' port = 51423
Python网络编程基础 gopherclient3.py
Monday, February 22nd, 2016#!/usr/bin/env python # Simple Gopher Client with file-like interface - Chapter 1 # gopherclient3.py import socket, sys port = 70 host = sys.argv[1] filename = sys.argv[2] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) fd = s.makefile('rw',0) fd.write(filename + "\r\n") for line in fd.readline(): sys.stdout.write(line)
Python网络编程基础 gopherclient2.py
Friday, February 19th, 2016#!/usr/bin/env python # Simple Gopher Client with basic error handling - Chapter 1 - gopherclient2.py. import socket, sys port = 70 host = sys.argv[1] filename = sys.argv[2] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host, port)) except socket.gaierror, e: print "Error connecting to server: %s" % e sys.exit(1) s.sendall(filename + "\r\n") while 1: buf = s.recv(2048) if not len(buf): break sys.stdout.write(buf)
Python网络编程基础 gopherclient.py
Thursday, February 18th, 2016import socket, sys port = 70 host = sys.argv[1] filename = sys.argv[2] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.sendall(filename + "\r\n") while 1: buf = s.recv(2048) if not len(buf): break sys.stdout.write(buf) ---- How to run it: python gopherclient.py quux.org /
ZT centos 6.2用yum安装中文输入法
Thursday, February 18th, 20161.su root
2.yum install “@Chinese Support”
3.exit
4.回到桌面,system->preferences->input method
5.如果没有,先注销一下。
6.按照提示添加输入法。
7.最后 再次注销,登录即可。
转贴:RHEL6基础二十三之RHEL使用centos的Yum源
Wednesday, February 17th, 2016由于RHEL的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件。在这种情况下,如果我们使用的机器安装的是RHEL系统要是每次安装软件先挂载本地光盘会很繁琐,而且有些软件也是老版本的,这种情况下我们可以借助CentOS的YUM源来满足我们的需求。
一、删除RHEL原有的YUM
1
2
3
4
|
[root@justin ~] # rpm -qa|grep yum|xargs rpm -e --nodeps warning: /etc/yum .conf saved as /etc/yum .conf.rpmsave [root@justin src] # yum install php - bash : /usr/bin/yum : 没有那个文件或目录 |
二、下载CentOS的yum安装包
本文出自 “我本不是菜鸟” 博客,请务必保留此出处http://pvbutler.blog.51cto.com/7662323/1320908