- Checkout code
cd ~/temp/bochs-svn/
svn co http://svn.code.sf.net/p/bochs/code/trunk/bochs
cd bochs| """ | |
| Script to test assignment 1. Subject to change. | |
| """ | |
| import json | |
| import unittest | |
| try: | |
| import requests | |
| except Exception as e: | |
| print "Requests library not found. Please install it. \nHint: pip install requests" |
| --- | |
| - hosts: all | |
| user: root | |
| become: yes | |
| become_user: root | |
| tasks: | |
| - name: Set hostname | |
| hostname: name={{ hostname }} | |
| - name: install packages |
| import psycopg2 | |
| conn = psycopg2.connect("dbname=endless") | |
| conn_new = psycopg2.connect("dbname=endless_new") | |
| cur = conn.cursor() | |
| cur_new = conn_new.cursor() | |
| cur.execute('select id from articles') | |
| article_ids = [id[0] for id in cur.fetchall()] |
This example uses curl. You can use any other means of making http requests. Responses are in JSON format.
% curl https://demo.frappecloud.com/api/method/login -XPOST \-d "usr=demo%40frappecloud.com&pwd=demo" -c frappe.cookie
{"message":"Logged In","full_name":"Demo User"}
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import matplotlib.animation as animation | |
| import serial | |
| def list_shift(a,x): | |
| del a[0] | |
| a.append(x) |
| # -*- coding: utf-8 -*- | |
| a = open('t.txt').read() | |
| # t.txt contains П001 | |
| s = [a] | |
| print [d.decode('utf-8') for d in s] | |
| # the line below fails | |
| #print [d.encode('utf-8') for d in s] |