Tag Archives: simple

Vim Search and Replace: Grabbing Image URLs from HTML source code

The following is a quick and dirty way of pulling a lot of URLs out of a given pages source code, using two commands in vim, my new favourite text editor. So, right to the point!

:v/jpg/d
:%s/^.*src="\(http:.\{-}jpg\)".*/\1/g

Try it out right now on the source code of Imgur’s /r/ScarlettJohansson’s page

Continue reading Vim Search and Replace: Grabbing Image URLs from HTML source code

Git Beginner Tutorial

This was originally a comment on reddit, but I figure it’d help other folks out, so I’m going to put it up here too.

So git, is a great tool for backing up your code projects, allowing you to easily save and manage different versions of your project among your friends and coworkers. But despite all the friendly packaging, on github, it was really intimidating. I didn’t know what a branch was, let alone a fetch, merge or anything even more complex like trunks and  bisecting. Eventually though, I got the basics sorted out. It was enough to send (push) a few of my repositories over to github. This was my basic experience:

Continue reading Git Beginner Tutorial

wxPython MediaCtrl Tutorial

This is just a short post to explain something I had a hard time understanding: How to get the media player working for Windows 7, (64bit, if that matters here, I’m not actually sure).

I never fully understood what it took to start playing a song, since I assumed that I needed to just load the song into the media player ctrl, then play it, but there was a subtle thing I needed to do as well, and that was to catch the event EVT_MEDIA_LOADED.

before I could sucessfully play the mp3, as well as change the backend of the mediaCtrl to WMP10, instead of leaving it as default. The part that really through me for a loop was that all the docs I had read on this, just loaded and then played the song right away. Seems like there’s a bug somewhere that doesn’t catch that event on Windows 7.

Anyways, here’s a simple script, after the jump, that lets you play one single song, hardcoded into the file, if you want to change the song to play, you’ll have to change the filepath in the code.

Continue reading wxPython MediaCtrl Tutorial