Uncategorized

Google Drive Terminal

So I started using github and realized I had to pay some money to make my code private and I did not want to pay money for that. So I started looking around for alternatives and came across bitbucket but I wanted to use my google drive. So I started writing a python script to control my google drive folder from my Ubuntu 14.04.

This app has one file called as drive.py and you can find the file at https://github.com/shady33/google-drive-terminal . Just download the file or clone it. This file is the main module that is responsible for all the commands. There is also another file that we need.If you want it you can drop me an e-mail and I will mail you the file. That file is basically a credentials.txt file in the .drive folder in the same directory where your project is. This file contains the client key and client secret and can also be obtained with the following method. Firstly, login to https://code.google.com/apis/console/ . Here you need to create a new project and enable the Drive API and Drive SDK in the API’s tab. You will then receive a Client ID for native application.  Copy the Client Id  and Client Secret to a credentials.txt file in the .drive folder on the first and second lines respectively. With this you will have a working drive for your terminal and you can call it by <code>python drive.py [command] [args]</code>

Now for the commands:

I have added the following 6 commands as of now and if and when I come up with a new command will include it in the source.

The first command is init. It basically creates the .drive folder for the application. Also when you do a init you will get a url which you need to open and copy paste the code in your terminal.

Second command is the origin where we add the remote url if needed for a particular folder and you dont need to run it if you wish to use the root directory.

Third command is add. It works similar to the git add where we add the files to be commited on later.

Next is the push. This command pushes the added files to your google drive.

Next is pull [args]. The valid args is all or nothing. If you input all as the argument then it will pull all files in that folder. If you do not use any arguments then all the files that you had pushed earlier would be pulled.

The last is upload. It is basically used to upload the file directly without a add operation. With this you won’t be able to pull the file after somebody has updated it.

I hope this helps you in some way. You can find the source at https://github.com/shady33/google-drive-terminal .

Cheers!

 

Leapcast – Chromecast for Raspberrypi

Leapcast is a software implementation of the Chromecast. It works on the same protocol that Chromecast does and can be easily used as a Chromecast device. What is interesting is that the cost of a Chromecast device and a Raspberry Pi is the same($35).

To use your Raspberry Pi as a Chromecast device follow the following steps:

1. Upgrade your Raspberry Pi

sudo apt-get update
sudo apt-get upgrade

2. Install Chromium  browser

sudo apt-get install chromium

3. Now we will install dependencies for leapcast and clone the git repository

git clone https://github.com/dz0ny/leapcast.git
cd ./leapcast
sudo apt-get install virtualenvwrapper python-pip python-twisted-web python2.7-dev

Now reset your ssh connection by typing exit and then again ssh into your Pi.

4.Now you are ready to run leapcast. Make sure your HDMI cable is connected.After that type

cd leapcast/
startx &
mkvirtualenv leapcast
pip install .
DISPLAY=:0 leapcast --chrome /usr/bin/chromium

If you get the error “failed to load nss libraries” then type

sudo ln -s /usr/lib/arm-linux-gnueabihf/nss/ /usr/lib/nss

With this i could stream youtube videos to my Pi but I have not tried the new screen cast feature yet. If you try it and it works please leave a comment.

 

 

Snapget – decryptor for Snapchat

Snapchat is a photo messaging application available for iOS and Android devices. This app helps in exchanging images and videos between contacts. What is special about this app is it deletes the image after the viewing time is over. Say if you send a image to a friend with a time limit of 10 seconds,he can view the image for a maximum of 10 seconds.

I started looking around for how snapchat stores its images till they are opened and found that they store the image in the app’s internal data folder which can be easily accessed if you have a rooted device. So i copied to *.jpg.nomedia file onto my computer and tried to open it but they had used a AES-128 encryption. I used the app’s apk file to see if i can find the key for encryption and it was hardcoded in the app in the crpyto folder under util in the com.snapchat.android package. I then decrypted the image using that key .

So now that i had all the essentials i made a small android  widget for saving the images . You need a rooted phone to use this app.  Download the source files from my github directory and compile it using eclipse. Install it on your phone and add the widget to your homescreen. Everytime you receive a snap open the app let the image complete loading .. go to your homescreen and press the button. The image will be at “/sdcard/Snapchat/” and it should also be there in your gallery.

Github directory : https://github.com/shady33/snapget-decrpyt