Saturday, March 19, 2016

How I was finally able to use Python to access and update google sheets

Connecting to google sheets via Python

So after hours of searching the web looking for how to connect to a google sheet, I was finally able to connect.

Found many articles that referenced deprecated modes of connecting,
  1. Get access to the Google  API from Google Developer Console and downloading the JSON file with your secret information, Secret Email, key etc.
  2. Don't forget to share the file with the email address in your JSON credentials - Took a long time to realize why I could not successfully access the file.
  3. The following code snippets could be refined by breaking up the code into methods, but currently I just worked it out a sequentially processed file. I will clean the code up now that things are operational.
  4. This code uses JSON, gspread and oauth2client packages
  5. Use pip install for gspread and oauth2client
  6. Links I need to credit are many, but the major is here and here.


This is a working script in Python 2.7 on Windows 7 running in Idle.

import json
import gdata.spreadsheet.service
import gspread
from oauth2client.client import SignedJwtAssertionCredentials

json_key = json.load(open('My Project-a0fcf0086cb5.json'))

print 'got key'
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'],scope)

gc = gspread.authorize(credentials)
print('Authentication complete')

wb2 = gc.open("test").sheet1
values_list = (wb2.col_values(1))
print('wbs vals loaded')
print (values_list)


Sunday, March 20, 2011

Mounting a clonzilla image

OK, so this was much tougher for me than it should had been, so I am documenting this for future reference.

How to mount a Clonezilla archive to pull out files on Ubuntu 10.10.

This will unzip the files in one single file called sda2.img and from there we will mount that image for access from where ever.
  • file /path-to-archive-file/sda2.ntfs-ptcl-img.gz.aa
    • will tell you about the file compression, etc.. not necessary because the archive name tells me it is a gzip file.
  • sudo cat /path-to-archive-file/sda2.ntfs-ptcl-img.gz.* | sudo gzip -d -c | sudo partclone.restore -C -s - -O /path-to-image-file/sda2.img
    • Took about 35 minutes on 77GB archive
  • sudo ntfs-3g /path-to-image-file/sda2.img /mnt
    • cd /mnt and you will see your files
Thanks to nutria007 in the ubuntu forums.



Add saa7134 kernel module

Add saa7134 kernel module Ubuntu 10.10


  1. sudo pico /etc/modprobe.d/saa7134.conf
    • Add lines:
      • alias chr-major-81 videodev
      • alias chr-major-81-0 saa7134
      • options saa7134 card=69,69,69,69 tuner=4,4,4,4 
  2. edit /etc/modules 
    • sudo pico /etc/modules 
      • add saa7134 to end of list
  3. sudo update-initramfs -u
    • writes module config


Webmin Server Administration

Webmin on Ubuntu 10.10 

  • wget http://sourceforge.net/projects/webadmin/files/webmin/1.530/webmin_1.530_all.deb
  • dpkg -i webmin_1.530_all.deb
    • will need to run apt-get install -f to fix dependency issues
    • in order to use as root, a root password needs to be set by doing "sudo passwd root" and enter root password
  • Thats it, browse to https://localhost:10000




Saturday, November 20, 2010

MJPG-STREAMER Ubuntu 10.10 Desktop

As follows are my notes to install and configure mjpg_streamer.

  1. Verify your camera is identified.
    1. open terminal and type ls -i /dev/video*
    2. you should see at least one device
  2. Download the deb package.
    1. Click open in download dialog box
    2. Select install from package installer window that opens.
  3. In the previously opened terminal type sudo apt-get install libjpeg-progs
  4. Type: apt-get install libjpeg62
  5. Type: sudo depmod -a
  6. Type: sudo modprobe uvcvideo
  7. Type: mjpg_streamer -i "input_uvc.so -d /dev/video0 -y" -o "output_http.so -p 8090 -w localhost"
  8. Open browser window and enter the address of http://localhost:8090/?action=stream
  9. You should see your video