04 Jun 2012I have a lot of music files on my computer. Some comes from CDs I encoded, other comes from the magic of file sharing. Most of them are in MP3
format, but I have a few ogg
and wma
tracks, mixed with even a bit of wav
or flac
files.
Even the mp3
files are encoded in a bunch of different settings, with various bitrates and frequencies. The only thing that is quite consistent in all that is that my tagging of metadatas.
Other than that it's quite a mess and has my collection grow larger, it starts to bother me. No two albums, even for the same music duration, are the same filesize.
I decided to clean a bit this whole mess. Let me explain my goal, and how I plan on doing that.
First, I want all my files encoded with the same settings, so the music I'm listening to and its file size is consistent accross different albums.
Second, I want all the files correctly taggued with track number, artist, album and song name. I don't really care about the year nor the genre. Genre is highly subjective, and year can be misleading in mixed albums like soundtracks, are we talking about the year of the release of the cd, or the year of the release of the individual song?
Third, I want all my files in ogg
format. First, because I want to get rid of as many proprietary format as I can, and mp3
is proprietary. But mainly because mp3
is an encoding format bloated with the previous layers of MPEG layer 2 and MPEG layer 1, resulting in larger file size and more encoding complexity.
And finally, I want to have the best sound quality that I can afford, without going to extreme like listening to FLAC
directly as my ears won't be able to catch the difference anyway.
So, I'm gonna buy a big hard drive, something around 1To I think, and put on it all my music files in FLAC
format, encoded directly from CD. This FLAC
files will have all the required metadata saved in them.
Then, I'll create an ogg
subdir in each of my album dirs where I'll encode my FLAC in ogg
with a bitrate of 128kbds (as the human hear won't be able to really get the difference with anything higher than that), and using the metadata from the FLAC
files.
Finally, I'll put the ogg
files on my portable media player and listen to them on the go.
I do not need to put the FLAC
on the PMP, has my ears won't be able to hear the difference. I only need to put a compressed version. Maybe in a few years, when PMP hard drive size will have increase I'll be able to increase the quality of my ogg
and use better quality files. If I ever need to do that, I won't have to rip the CDs again as I'll already have the FLAC
to create the encoding.
This will be hard work, but I guess it will be worth it in the long run. At least, now I know a bit more about encoding formats and settings.
25 Feb 2012Today, at about 9pm (GMT+12), I found my own blog hacked. When I wanted to access it, I was redirected to a malware site.
Half an hour later, it is back online again, and here is what I did.
First, I downloaded the webpage on my computer using curl http://www.pixelastic.com/
to analyse it in search of a clue on the attack vector.
Unfortunatly, I couldn't easily find the culprit. No img
tag loading a php
file, no XSS injection that I could find. My guess is that the attacker tampered the js
files loaded to add its own custom evil script. But as my js files are concatened and compressed in a file with a md5 name, it wasn't obvious that they had been compromised.
After that, I ssh
ed to the server and tried to find what files where modified since my last commit. As I'm using Mercurial for that, this was a simple matter of hg status.
And I got a shitload of result. Actually, all my php
files had been modified (and as I'm using cakePHP, that means, a lot of file). Running hg diff
, I found out that all the php code of each file had been replaced with an evil code (enclosed in several layers of eval+base64).
I updated my working directory to the latest commit with hg update --clean
to get all those files as they were before the attack. Running hg status
once more still showed a bunch of new php files added. Running hg purge
finally get rid of them.
I finally deleted all the compressed css and js files, to force them to be created again, and that's it, the website is online again.
I still don't have a clue on how this happened. How did someone access my files ? Is that an XSS attack ? Is my password cracked ? Is there another security weakness I'm not aware of ?
EDIT : Got hacked again. Seeing that the cakePHP Cache files were deleted, I guess it is a known attack on a cake vulnerability. Got the website up again, but will fix it as soon as my holidays allow.
23 Jan 2012As I'm about to move for a couple of long months without an internet connection and a lot of travel hours, I thought of downloading the TEDTalk podcasts.
Being a linux user for about a year now, I'm taking the habit of using the linux tools to do the boring and repetitive work. Downloading more than a hundred files seems like a good candidate for a script.
The complete list of audio podcasts is available here. I simply selected all text and copied it into a file.txt
.
Then, it was simply a matter of extracting only the urls, and feeding them to wget
cat file.txt | tr ' ' '\n' | tr '\t' '\n' | grep http > list.txt
wget --no-clobber -i list.txt
This took a while to download as there are more than 400 files, but that way I'll have some interesting talks to listen to during my trip.
17 Jan 2012Here's one more post in my productivity serie. This one is about the Dropbox service.
What is Dropbox ?
In a nutshell, Dropbox is a private hosting service, based on a cloud infrastructure. Once you've installed the app, one of your folders (default to ~/Dropbox
) became synchronized with your Dropbox account. Every document that you save in that folder, and any subfolder you create, will immediatly be saved online in your Dropbox account.
In the real world, it means that you can easily share one folder and all its documents easily between all your computers. If you don't want to install the app, you can simply log to dropbox.com and download/upload any file you want.
How I use it
There a few ways you can use Dropbox. Here are a few of mine, feel free to add yours in the comments.
As I used to work on Windows (and I still have to sometimes), I always had to install a bunch of apps on a brand new computer before being able to start working. This includes the traditional antivirus, browser, music player, IDE, etc. Instead of going through the laborious process of downloading all the installer on each of the websites, I've saved them in my Dropbox and I just have to install Dropbox, then install the apps I need.
Instead of a bunch of todo.txt
files spread accross all your computers, wouldn't it be tidier to only have one, shared ?
The same goes for the KeePass file, so you can have an easy access to all your passwords.
I also use it to synchronize my Tomboy notes between my computers (I'll go into more details in another note).
It might be a bit excessive, but I personnally also share my icons, sounds, wallpapers and other customization stuff, so I won't feel lost on a new computer.
Thanks to the amazing Doxie scanner (more on that on another note), I'm now a scan junkie. I scan all the official paperwork I got in my physical mailbox and store it in the Dropbox.
Be it a bill or a banking receipt, I scan anything that looks like official and that I might need again one day. That way, I know I can always connect to dropbox.com and find any official document of the past 5 years in a matter of minutes. This saved my day quite a few time already !
Last words
Dropbox is a free service. You can have 2Go for free, or pay for a more space. I personnaly only use a fraction of that so I stay on the free plan. I haven't mentionned it because I don't use it, but you can also share some folders with other Dropbox users, which is a nice addition when working on the same project.
07 Jan 2012In a previous post, I bloggued about the way to emulate OOCSS behavior with multiple classes in IE6.
Today, I'll do a follow up and write about a possible gotcha involving the :visited
pseudo class.
Following the previous example let's imagine you have a styling for your defauls links (a { color:blue; }
), one for the default buttons (.button { ... }
) and one for a custom button that extend the .button
(.customButton { ... }
)
Now, imagine that you'll want to style all :visited
links the same way non- visited links are styled. You might write something like :
a, a:visited { color:blue; }
Unfortunatly, this will have some nasty side effects on your .button
and .customButton
rules because a:visited
will have precedence over .button
and .customButton
You can find more information about CSS specificity in this Star Wars post.
Your first solution could be to add even more specificity to your own rules, to override the a:visited
one, like so :
.button, .button:visited { ... }
.customButton, .customButton:visited { ... }
This will work, of course, but you're only adding complexity to your specificities, and this get more and more tedious the more you add other customised buttons.
In fact, there is a much better way, one that you could throw in your reset.css
if it isn't there already :
a:visited { color:inherit; }
That way, all your visited links will inherit their color from their non- visited version. This mean that visited .button
will use the .button
color, visited .customButton
will use .customButton
color and simple visited links will use the a
color.
Of course, if you defined a background-color
in your a
, you should define a background-color:inherit
in your a:visited
too.