Skip to main content

Posts

Showing posts from October, 2010

Some ssh tricks

1 ssh log on without password 1) in localhost, ssh-key-gen 2) in localhost, ssh-copy_id username@remotehost 2 remove entries from known_hosts you may get the error like the following message, if remotehost change it's ip address: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ... Add correct host key in /home/username/.ssh/known_hosts to get rid of this message. Offending key in /home/username/.ssh/known_hosts:$line_number$ ... To solve this, you may 1) edit ~/.ssh/known_hosts 2) remove line $line_number$

Some svn tricks

1.Sovle checksum mismatch when update   When performing "svn up test.h", you may get error:   svn: Checksum mismatch for …   To solve the issue, you may want to backup files mentioned below, and perform following actions:   1) vi .svn/entries, find and delete content like  ^L test.c file 712 2010-10-24T09:39:39.000000Z d41d8cd98f00b204e9800998ecf8427e 2008-10-21T19:51:09.435185Z 3 foo 0 ^L 2) delete related files in .svn/text-base/(e.g., test.c.svn-base) 3) delete related files in .svn/tmp/text-base/   4) delete test.c 5) svn up test.c

The "hello world" for celery

This is a simple "hello world" case for python based task queue celery on ubuntu 9.10. Install sudo apt-get install rabbitmq-server sudo easy_install celery In celerytest directory: Create celeryconfig.py: BROKER_HOST = "localhost" BROKER_PORT = 5672 BROKER_USER = "guest" BROKER_PASSWORD = "guest" BROKER_VHOST = "/" CELERY_RESULT_BACKEND = "amqp" import os import sys sys.path.append(os.getcwd()) CELERY_IMPORTS = ("tasks", ) Create tasks.py: from celery.decorators import task @task def add(x, y):     return x + y Start celery worker: celeryd Excute the program: python -c "from tasks import *;r=add.delay(3,5);print r.wait()"