Wednesday, 1 June 2016

Hanging on.

Twice in one day - we gotta stop meeting like this.

You may have noticed the twitter bots returned a short moment ago.
So what was the goodbye about?

There's a caveat to the return:

  • This is very unofficial. And may stop at any moment.  (i.e. When Instagram realizes what's happening and blocks us, haha)
  • We can automatically retrieve Instagram photos and videos, but comments are now a no-go.
  • If an idol changes their Instagram username, we won't be able to get their updates until we are notified at admin@kpopsnaps.com and have their username manually updated. 
And many thanks to @thegoguma for all their help. 
Lifesaver, or should I say, Snapsaver. 
(walking away now)

End of an Era: Goodbye to the Instagram API

Instagram updated their API today.

Unfortunately, the updates mean that from today onwards, Kpop Snaps can no longer automatically retrieve Instagram photos, videos and comments.

If you would like more information on the Instagram API update, you can read about them here.

We will continue to post Weibo updates.
Thanks for all your support so far.

Tuesday, 10 March 2015

Updating Tweepy to v3.3.0 on Google App Engine.

The old version of Tweepy I was previously using was outdated and Twitter api had updated endpoints, namely, media_upload and update_status that accepted media_ids.

Here's what I did to update/install Tweepy v3.3.0 on GAE:
DISCLAIMER: These instructions are by no means the best way of doing this. Most steps were simply googled. These posts are more for self reference if I ever encounter the problem again.

I decided to write a post since the closest help I found online directly related to this issue was:
http://discuss.tweepy.org/t/tweepy-with-the-google-app-engine/146/2

Adding python libraries to appengine

You may want to create a new folder of thirdparty libraries that you will be adding very shortly if you haven't already.

Follow the instructions here:
http://stackoverflow.com/a/2354273

or a summarized version below:

Create a new directory in your root folder called /thirdparty.
Your root folder is where you would have your app.yaml file.
Inside /thirdparty, create an empty __init__.py file.

In your root folder, create a new file - i.e. fix_path.py
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), "thirdparty"))
and in your main.py, add

import fix_path

before all other imports.

Installing Tweepy:

I cloned the tweepy into a new directory

git clone https://github.com/tweepy/tweepy.git
And copied the tweepy folder to /thirdparty  (i.e you would have /thirdparty/tweepy/api.py)

If you try running your dev server now, it will complain:
ImportError: No module named six

So go to https://pypi.python.org/pypi/six/ and download the tar file. Unzip it and copy the six.py file straight into your /thirdparty directory. (i.e. /thirdparty/six.py)

If that's all working, then the next error you'll see is:
ImportError: No module named requests
git clone git://github.com/kennethreitz/requests.git
Copy the requests folder into your /thirdparty folder. (i.e. you would have /thirdpary/requests/api.py)

If you see:
ImportError: No module named 'requests.packages.urllib3'
Try deleting some of the *.pyc files. Don't know if that was usual, but it worked for me.

Next error:
ImportError: cannot import name certs

Kind sir here solved this one for me:
https://groups.google.com/forum/#!msg/pythonforfacebook/7aOvlz6SvPg/wrkGSyK1ij0J

Add ssl to your app.yaml libraries. 

libraries:
- name: webapp2
  version: latest
- name: ssl
  version: latest

Moving on:
ImportError: No module named requests_oauthlib
git clone https://github.com/requests/requests-oauthlib.git
Copy the requests_oauth folder into your /thirdparty folder.

Next error, almost there:
ImportError: No module named oauthlib.common
git clone https://github.com/idan/oauthlib.git
Copy the oauthlib folder into your /thirdparty folder. (i.e. You would have /thirdparty/oauthlib/common.py)
and.. done.

Friday, 24 October 2014

Updating Windows 8 to 8.1 with dual booted Debian Wheezy

The other day, I got sick of having to close the update to 8.1 reminder every time I booted in Windows. So instead of doing the smart thing like ignoring it, or finding a way to stop the reminders, I hit update.

No backups, no nothing prepared. Silly me.

My setup was Debian Wheezy dual booted with Windows 8.

When I finished the update, grub no longer loaded to boot into Debian as my first option.
Instead I had to manually select it in the boot loader.

What greeted me was grub rescue.

As a noob with os/linux/terminal related things.. I went and googled.

I found my Debain Wheezy disk, and tried to go through the graphical recovery, mostly following the steps here: http://azerdark.wordpress.com/2010/01/24/restoring-grub-in-debian/

However at the installing grub step, it didn't seem to do anything. There were no error messages, but at the same time, on reboot, there was no difference.

So I gave up on the disk, and tried restoring through grub rescue.

Mostly followed a mix of the instructions here:
http://unix.stackexchange.com/a/148042
http://askubuntu.com/questions/119597/grub-rescue-error-unknown-filesystem

<grub rescue> set root=(hd0,gpt7)/boot
<grub rescue> set prefix=(hd0,gpt7)/boot/grub
<grub rescue> insmod linux
<grub rescue> linux (hd0,gpt7)/boot/vmlinuz-3.2.0-4-amd64 root=/dev/sda7
<grub rescue> initrd (hd0,gpt7)/boot/initrd.img-3.2.0-4-amd64
<grub rescue> boot

I manged to boot into my debian (phew), at which point, I first went to commit and push my code to my repo. haha.  and then

sudo grub-install
sudo update-grub

and yay it was fixed. I feel like I just combined 3 hours of stress into an easy few steps.

On another note. My laptop is a Lenovo z400. I'm not sure at which step and how (potentially when installing updated drivers), but at some point in time, my UEFI security boot was changed from disabled to enabled. And I spent another couple of hours debugging why my debian was not loading again. I so fail.