Skip to content

Instantly share code, notes, and snippets.

"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time

Test Intruments Driver in Python

Introduction

IVI, VISA, SCPI

SCPI stands for Standard Commands for Programmable Instruments (SCPI), the commands is pure ASCII String, no physical communications link is not defined, it can be used in USB, GPIB, RS-232, Ethernet, VXI, etc.

Example for Ubuntu14.04

Here is an example to make an Agilent U3606A (multimeter and DC power supply, usb interface) to work on Ubuntu 14.04.

#!/usr/bin/env python
# encoding: utf-8
'''
This module is used to convert diction to xml and convert xml to diction
usage:
import simplexml
simplexml.dumps(dict) # output xml string
simplexml.loads(xml) # output python dict
changelist:
0.2: add unicode support.
#!/usr/bin/env python
# encoding: utf-8
import os
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
from matplotlib import cm
import time
@countrymarmot
countrymarmot / task.py
Created August 6, 2014 06:28
test celery
"""tasks.py
"""
from __future__ import absolute_import
from celery import Celery
from celery import exceptions
app = Celery('tasks', broker='sqla+sqlite:///msg.db', backend='db+sqlite:///result.db')
app.conf.update(CELERY_TASK_SERIALIZER='json', CELERY_ACCEPT_CONTENT=['json'], CELERY_RESULT_SERIALIZER='json')
"""
test bom structure, use sqlalchemy
"""
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
db = SQLAlchemy(app)
"""
test bom structure, use sqlalchemy
"""
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
db = SQLAlchemy(app)
console-log-level=info
#开启RPC 远程访问
enable-rpc=true
#rpc-listen-port=16800
rpc-listen-all=true
rpc-allow-origin-all=true
rpc-passwd=i-am-http-auth-password
rpc-user=i-am-http-auth-user
event-poll=epoll
#!/usr/bin/env python
# encoding: utf-8
from functools import wraps
import logging
import signal
"""test retry and timeout decorator
"""