Blog

21Mar/160

News in Technology

It's been a long time... Today I decided to update my blog once again, with some interesting and new videos. Here we go:

- Google's AI won the series of games against the Go grandmaster:

- Machine learning and computer vision can get really crazy. Here is NeuralTalk (and Walk):

NeuralTalk and Walk from Kyle McDonald on Vimeo.

- This example of 3D face manipulation in videos seems really out of this world:

Share
30Mar/140

New Python Script & A Glitch GIF

tumblr_m5lka6MOu81r61vp5o1_250

It's been a while since I've been randomly playing around with code and formats of files, so I thought it's about time for me to do so.

I wanted to buy a LOMO, but since I believe all LOMO machines are offensively expensive, I wanted to buy it second hand. I checked a nation-wide online flea market called willhaben.at and found several posts but none of them was interesting to me. But I wanted to keep a track of them, so I wrote a small script that does the job for me. Instead of visiting the website all the time, I hardcoded the link of the web page to the script and it does the job for me. Here is the code:

import urllib2
file = urllib2.urlopen('http://www.willhaben.at/iad/kaufen-und-verkaufen/marktplatz?keyword=lomo&x=0&y=0&sort=4')
dload = file.read()

searchString = "<strong>60</strong>"

if searchString in dload:
print "HTML File has not changed, still 60 posts."

else:
print 'HTML File appears to have changed, please check: \nhttp://www.willhaben.at/iad/kaufen-und-                           verkaufen/marktplatz?keyword=lomo&x=0&y=0&sort=4'

This may look silly at first, but that is only because the code is silly. Seriously, I just parse the HTML from the source, and look for a "<strong>60</strong>" which is totally arbitrary, but in this specific case it was the number of posts that are already shown. So if it changes, the code prints "HTML File appears to have changed, please check..." and that's it.

For running it, I just press Windows key + R, then type cmd and hit ENTER. Then go to Python directory and locate the script and run it. That's it. Pretty simple but that was what I needed anyway.

The other one is just a 10-minute fun, so I'll just leave it here. Because it's peanut butter jelly time.

Share