Using psmisc in python i’ve found this function quite useful in many projects i’ve been working lately.
Basically it will kill all the process older than one hour that match “name”
All those try except are just to avoid permission denied on kill or on name check.
now = time.time()
for p in psutil.get_process_list():
exe = ""
exe = p.exe
if name in exe:
exetime = now - p.create_time
if exetime > 3600.0:
print "killed %s ( %d s of execution time)"%(exe,exetime)
Since i find myself in a lot of trouble when going to a new linux system due to misconfigured vim i thought
i might share with you my tipical default configuration for vim that is good for developing in python
here are the main lines, since i use a dark background i like a lot the “background=dark” feature
au BufReadPost * if line("'\"") > 0 && line("'\"") < = line("$")
\| exe "normal g'\"" | endif
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab " Python
autocmd FileType make set tabstop=8|set shiftwidth=8|set noexpandtab " Makefile
autocmd FileType man set tabstop=8|set shiftwidth=8|set noexpandtab " Man page (also used by psql to edit or view)
autocmd FileType calendar set tabstop=8|set shiftwidth=8|set noexpandtab