Skip to content

Instantly share code, notes, and snippets.

View pdvyas's full-sized avatar

Pratik Vyas pdvyas

View GitHub Profile
pdvyas /
Last active September 15, 2022 01:53

Compile bochs

  • Checkout code
cd ~/temp/bochs-svn/
svn co
cd bochs
Script to test assignment 1. Subject to change.
import json
import unittest
import requests
except Exception as e:
print "Requests library not found. Please install it. \nHint: pip install requests"
pdvyas / vm.yml
Created February 27, 2016 22:58
VM build server playbook
- hosts: all
user: root
become: yes
become_user: root
- name: Set hostname
hostname: name={{ hostname }}
- name: install packages
pdvyas /
Last active January 13, 2016 05:54
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()]
pdvyas /
Created May 26, 2014 09:11
Sales Invoice REST API example

This example uses curl. You can use any other means of making http requests. Responses are in JSON format.

  • Login to frappe (and store cookies in a jar)
% curl -XPOST \-d "" -c frappe.cookie   
{"message":"Logged In","full_name":"Demo User"}
  • Request for a Sales Invoice by id (output is piped to json pretty printer(optional))
pdvyas /
Created August 13, 2012 22:15
Serial value plotting
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import serial
def list_shift(a,x):
del a[0]
pdvyas / gist:2198372
Created March 25, 2012 17:12
A trip to Unicode
# -*- 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]