Imgur album image downloader pt.2

Hello dear reader 🙂

I was bothered by the way I wrote script for imgur downloader, cuz there are more sophisticated ways to do it. That is why I decided to use more Python system function, which made the script more readable, and customizable. This script uses urllib, urllib2, urlparse libraries for work with image and page URLs.

The thing I added to the previous version is fullscreen option, and directory where to download album.

Anyone interested can ask for source, and I’ll be glad to share it.

Bye!

Imgur album image downloader

Hey hey, here I am with a new cool thing. It is imgur album downloader.

Now, I know there are some imgur album downloaders, but I could not run the Windows version, and I did not bother with any other. I have decided to write my own imgur album downloader. There are some constraints, which are:

  • it works in only two conditions (if you specify album link, containing /a/ in link, or link to group of albums, with imgur.com within link),
  • there is only one page of albums thumbnails (maybe imgur displays all albums thumbnails on one page, I’m not sure),
  • you have to make dir, enter the dir in console and run the script in it (then script makes dirs with albums names, and puts pictures in those dirs).

Regardless of constraints, script can be easily changed to support various links, and parsing techniques. I encourage everybody who is interested in having a nice imgur album downloader, to try and change it, so we can all benefit from it. Here is the Python 2.7 script. Sorry for no comments in code, I did it quickly, and I think that functions names are very intuitive, if that is of any help 🙂

Things that could be done:

  • implement string matching through regex
  • add support for galleries,
  • add support for multiple pages,
  • add nitty GUI (gtk or maybe PyQt).

Cheerz. Bye!

Ganglia HDD plugin

Hey hey,

Like I said, it was lot going on. One of things was my first ganglia plugin. Let’s cut to the meat! 🙂

Plugin is developed for Debian like and Red Hat like systems (deb and rpm package). It is for personal use on grid cluster. Private in sense I did not write all documentation for packages, like for example man pages.

How I did this? I have used gmetric ganglia set tool, for making my custom metrics. Main tool is of course binary made by HD Sentinel, for listing hard disk info, like temperature, health, hours of work etc. Part of the package is script that is extracting basic data from HD Sentinel output and sending it to gmetad by gmetric script. To be precise, I used extended gmetric script written in Python. Reason was I needed grouping option, which default gmetric tool doesn’t have. GmetricP (P from Python) does grouping and sends it to gmetad daemon on main node with ganglia web page, displaying it under custom metrics.

Ganglia HDD Plugin

This is not very clean and pretty way of doing it, but it does the job. Better way would be to write ganglia plugin in Python, like described in ganglia documentation.

Bye!

Where are Chrome’s flash temporary files [UBUNTU]

I had the same question! Where are the files? They used to be in /tmp named with Flash… What happened? Is something changed in google chrome, or in Ubuntu?

I have read a lot of papers, and the most of them is pointing to the ~/.cache/google-chrome folder. It’s the folder where you should find google chrome’s cache files. But there are no big flash video files, just small ones. Suppouse you watch some youtube video, and you like it so much you want to keep it in your home folder for some time. Let’s say it is 100MB big. That file wont be stored in google chrome cache folder. Where will it be stored then? I don’t know and I’m not sure where to look, but I did some tricks and found them. Let’s explain the tools.

First, I have opened youtube file and let it stream from internet. In the meantime I used df command to see what part of my file system is receving data. It was not my /home folder. It was / file system.So, place to look for file was better located, but searching through / would take “millions” of years. I tried to use du command for folders in / , except /home , to see which folder is having his size changed. But calculating folder size was very time consuming and if folder is big enough, you will have to wait quite some time for calculating difference between sizes of same folder in 2 particular moments. So, that kind of solving the problem was not very good. Then, I asked google for advice. I wanted to see which process on my system is using which file. The command for it was lsof.You should read next two references before going any further, because what I’m about to do is going to have explanation only for this specific problem.

http://superuser.com/questions/235535/in-google-chrome-on-linux-where-is-the-flv-if-not-in-tmp

http://www.ibm.com/developerworks/aix/library/au-lsof.html

From now on, we’re going to concentrate on finding those flash files!

First, you should get PID of chrome. You can use various commands, but ps or top will do just fine.When you get the PID, you should use

lsof -a -p [PID] -u [USERNAME]

This is going to list all files that are used by process with PID, which is executed under user USERNAME. Flag -a is for logical AND so list will contain results which fulfil both contidions. Somewhere in the list are files called Flash…. (deleted), right? Yes, we are looking for them. It should list something like this:

chrome  17621 [USERNAME]   23u   REG        8,8 12764804   394927 /tmp/FlashXXmR06LN (deleted)

Ok, as you can see, we have chrome with 17621(PID), having opened regular(REG) file for read/write(u), under [USERNAME] with size 12764804, 8,8 device and 394927 node. Of course last part is file name. Now, I’m not going to explain all these things because you should already know them if you have read those references back up there.

Here comes the nasty part. You need root privilege to view processes information. Go in /proc/[PID]/fd and do ls -l . This is going to list file descriptors with links to the files, among which are our Flash…(deleted). You should copy them anywhere on the system, and change owning of file, because you have copied it as root. Now, you can view the file with your favourite player.

That’s it ppl. After all this, I ask myself, is it worth doing all this for video, and why is place for temporary videos changed from /tmp folder???

Bye

Gnome terminal scroll doesn’t work

Hey hey, it’s me and I’m here to get you few hints on this problem.
So let us begin.
As serious Linux user, I always use terminal. Since I’m Gnome user, I use default terminal called gnome-terminal. Using it for administration and programming, makes me want to change it’s profile, to make it look relaxing for my eyes. So I did some changes and also removed scroll function from terminal when I’m in vim or viewing man pages. That was big mistake, and I did not realize what I’ve done that moment. So after a while, I was stuck in vim or man pages using keyboard up and down keys. Pain in the aaaday 🙂 I tried to find some answers on google knowing that someone was also having the same problem. But I guess not. Or I did not have patience to look for it long enough.
Then I realized I have to do some searching through options in gconf-editor. Handy little thing. After searching scroll, mouse, terminal I have found that Gnome keeps the default profile of terminal with a lot of options, and profiles that you make has few options. First of them is alternate screen scroll. That is our problem. If it is unchecked, then you can’t scroll when you are in VIM or viewing MAN pages. After you check it, you will be able to do that.
Now I can relax in chair scrolling up and down through my code in C never bothering to do up down navigation by keyboard. Yey!

Using Komodo Editor Symfony plugin

This would be the continuance of the PHP Symfony Editor post.

This time, I’m going to tell you something about this particular plugin for Komodo Editor. I think you can use it in Komodo IDE, but I’m not quite sure.

Anyway, you can download it here.

When you download file with the kpz extension, you have to open toolbox in Komodo Editor, and select import kpz package. You can import it from the URL also.

When you finish importing and open the menu in the toolbox, you’ll see shortcuts to symfony commands. There is a little problem here, or at least it was for me.

Since I use centralized Symfony installation, and also work on GNU/Linux, accessing symfony commands with symfony wont do the job. Also there is the problem with the configure->database shortcut.

First things first!

To work around first problem, I did next:

Created symfony.sh file in my home and typed next code: php5 /var/www/symfony-1.4/data/bin/symfony $*

With it, I’m sure that running the symfony.sh, I will be running script of centralized Symfony installation. $* is for all arguments that are passed to my symfony.sh. Then I make it executable with chmod u+x, but you can make it executable for all users on system. Then, you have to make soft link in /usr/bin pointing to the symfony.sh script. Basically, with this, you can be in any directory and still be able to run symfony command, which will run the symfony.sh script. This way, following any of komodo editor shortcuts, you will be accessing reall symfony commands.

Second thing is that, when you try to do configure->database you’ll get this output:

Task “configure:database” is not defined.

This is because, database command is not positioned in the project directory, and is trying to run symfony command, which is not available if you do not have created project. This thing is easy, you just right click on this shortcut, and type %p in Start in edit.

These are the problems I found, while testing this plugin. I did not test every command, so if you get some error, I’d be glad to hear the problem.

Bye!

PHP Symfony Editor ?

Hey hey! Fresh stuff again! 🙂 This time it is symfony again!

Lets cut the chatting and get straight to the point!

What IDE are you using? Is it fast, is it comfortable, does it have plugins for Symfony?

You are saying, yeess, NetBeans has it, though it is not very fast 😦 All that Java is eating my memory…

If you have it a lot, that that is not a prob, but what if you are short with that resource??? Lets say you have, oh I don’t know, a virtual machine, which you use for developing. You don’t want all that projects, files and junk to be in your sweet home and to look it every day in your spare time :D. So you make virtual machine and use it to do all the work, then shut it down, and the nightmare is forgotten. YEY! But in case you do not have a resource monster computer, or some kinda super computer, virtual machine will have less RAM than host on which you are running it. That is the main part, where you might have the problems with NetBeans or Eclipse. They are sooo sloow on virtual machines… Or I am not well informed, and I do not know some hints to make them faster. If you do, please inform me below 🙂

CUT THE RAMBLING 🙂 GET TO THE POINT!!! silly me 😀

I went some googling about php editor which has support for symfony. There were NetBeans (newest version), Eclipse (with its plugins), PHPEdit (which is shareware, and being a student, I don’t have too much money to spare on software), Komodo IDE (shareware), but WAIT! Komodo Editor!?

That is free, as in speech, dynamic languages editor. Mmmm nice? PHP, Python, Shell, Perl etc. Mmm nice!!! Built in C++!? Weeell, it is based on Mozzila Framework, which among all includes C++ libraries. Faster than NetBeans or Eclipse, which are Java based… Has some plugins for symfony… WOW! You must be dying from wish to try it! 🙂

Here you go http://www.openkomodo.com/ Komodo Edit

So you download it, and what? How, to use if for developing Symfony projects??? That is the right question! And, since this post took me some time, I’ll describe basic project generation in this post.

I’d be very interested in reading your comments, because I see some interest in symfony… Bye 🙂