Posts tagged ‘Python’

Chinese character display with VPtyhon

VPython到底能不能显示中文字符?能显示哪些中文字体?下面的code给出答案。

Continue reading ‘Chinese character display with VPtyhon’ »

Install Python modules as non-root user on HPC cluster

The key steps

1. Create a folder named “~/python-packages”, then create a path “~/python-packages/lib/python2.6/site-packages/” with

1
mkdir -p python-packages/lib/python2.6/site-packages/

The above path containing the version number of Python should be adjust accordingly base on the actual Python version you are using.
This step sets up a directory structure that is needed by python modules.

Continue reading ‘Install Python modules as non-root user on HPC cluster’ »

Python initial script for Qtiplot

OK, even after reading the handbook a few times, it is not very clear which python file is the initial script for Qtiplot. It is important to know if you want to extend Qtiplot with python. After checking all the default python files in the Qtiplot installation path, I found qtiplotrc.py should be the one, although a smarter guy would have realized this from its name. You could import your own Python module in this startup file and enjoy them right after entering Qtiplot.

Animation with matplotlib

A demo program showing the way to make animation with matplotlib.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# A demo for animation with matplotlib
# Written by Ting Li (Dr.Ting.Li at gmail.com)
# 2010-09-10
# Ref: http://www.scipy.org/Cookbook/Matplotlib/Animations
import numpy as np
import time
import matplotlib
matplotlib.use('WXAgg') #before import pylab, choose the GUI backend
#It can also be done while calling this script from command line:
#>>> python animation.py -dWXAgg
#Other backends are: valid strings are ['ps', 'Qt4Agg', 'GTK', 'GTKAgg', 'svg',
# 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', 'TkAgg', 'QtAgg', 'FltkAgg',
# 'pdf', 'CocoaAgg', 'emf', 'gdk', 'template', 'WX']
from pylab import *

 <a href="http://9rivers.linkka.com/2010/09/11/animation-with-matplotlib/#more-561" class="more-link"><small>Continue reading &#8216;Animation with matplotlib&#8217; &raquo;</small></a>

评书吧批量下载脚本

通常只要修改Page_name和total_pages即可实现自动换页批量下载,喜欢听书的朋友可以试试。

Continue reading ‘评书吧批量下载脚本’ »

Hide the command console window while running a GUI/Command line program on Windows

While running a command line program or some GUI initiated from command line on Windows, there is always a black console window on the screen. This sometime becomes annoying. For example, when you start the Eric Python IDE on Windows, normally you start it by calling a batch file “eric4.bat” which calls the actual eric4.py script sequentially. Since Eric4 is designed to be a GUI program, the black console window has no use but it is there. To prevent that or hide it, there are several ways. Continue reading ‘Hide the command console window while running a GUI/Command line program on Windows’ »

Python模块的反安装

Python的distutils可以很方便地制作模块安装程序,但是没有提供反安装/卸载功能。

Continue reading ‘Python模块的反安装’ »

PiCloud 基于Python的云计算平台

Print directory tree on Windows and Linux using tree, sed, awk or Python

SSH tunneling and example Python client-server codes

This document demonstrates how we could run client-server software via SSH. The main purpose of using this technique relies on that on most HPC servers most of the IP ports are nromally blocked except for the SSH port 22.

  1. SSH tunneling settings in PuTTY
    In this case, the server port 8888 is mapped to the local port 7777. The meaing of this is simple: once connected to the server using PuTTY, any data on the server sent/received at port 8888 will be redirect to the port 7777 of the local machine (the computer you are using PuTTY at the moment). As a result, any client software running on the client computer can communicate with the server program via the local port 7777.
    Continue reading ‘SSH tunneling and example Python client-server codes’ »