vanutsteen.nl => nerds only » python http://v3.vanutsteen.nl A blog on rails, php, computing, my bass guitar and stuff Thu, 20 Sep 2012 06:26:30 +0000 en-US hourly 1 http://wordpress.org/?v=3.5 Gitlab reque & supervisord http://v3.vanutsteen.nl/2012/08/07/gitlab-reque-supervisord/ http://v3.vanutsteen.nl/2012/08/07/gitlab-reque-supervisord/#comments Tue, 07 Aug 2012 08:38:16 +0000 LeonB http://www.vanutsteen.nl/?p=765 Gitlab needs at least one resque daemon. I always forget to start it when I boot the (virtual) pc where gitlab resides. So I installed supervisord an set up this conf file:
/etc/supervisor/conf.d/resque.conf:

[program:resque]
command=bundle exec rake environment resque:work
# Do not use BACKGROUND=No, it only checks if BACKGROUND is set
environment=QUEUE="post_receive,mailer,system_hook",RAILS_ENV="production"
process_name=resque
numprocs=1
directory=/home/gitlab.tim-online.nl/public_html
autostart=true
autorestart=true
user=gitlab.tim-online.nl
]]>
http://v3.vanutsteen.nl/2012/08/07/gitlab-reque-supervisord/feed/ 0
Installing & using flexget http://v3.vanutsteen.nl/2012/07/16/installing-using-flexget/ http://v3.vanutsteen.nl/2012/07/16/installing-using-flexget/#comments Sun, 15 Jul 2012 22:05:18 +0000 LeonB http://www.vanutsteen.nl/?p=704 Install dependencies from Ubuntu repositories
sudo apt-get install python-setuptools python-transmissionrpc

Edit ~/.pydistutils.cfg

[easy_install]
user = true

Install flexget

easy_install flexget
mkdir ~/.flexget

Edit ~/.flexget/config.yml


feeds:
  Coder Radio Video:
    rss: http://feeds.feedburner.com/coderradiovideo
    exists: /media/freenas/podcasts/Coder Radio Video/
    download: /media/freenas/podcasts/Coder Radio Video/

  Dev1.tv:
    rss: http://feeds.feedburner.com/dev1tv
    exists: /media/freenas/podcasts/Dev1.tv/
    download: /media/freenas/podcasts/Dev1.tv/

  FauxShow HD:
    rss: http://www.jupiterbroadcasting.com/feeds/FauxShowHD.xml
    exists: /media/freenas/podcasts/FauxShow HD/
    download: /media/freenas/podcasts/FauxShow HD/

  In Depth Look HD:
    rss: http://www.jupiterbroadcasting.com/feeds/indepthlookihd.xml
    exists: /media/freenas/podcasts/In Depth Look HD/
    download: /media/freenas/podcasts/In Depth Look HD/

#  TechSNAP Large Video:
#    rss: http://feeds.feedburner.com/techsnaplarge
#    exists: /media/freenas/podcasts/TechSNAP Large Video/
#    download: /media/freenas/podcasts/TechSNAP Large Video/

  The Changelog:
    rss: http://feeds.feedburner.com/thechangelog
    exists: /media/freenas/podcasts/The Changelog/
    download: /media/freenas/podcasts/The Changelog/

#  The Linux Action Show! Video:
#    rss: http://feeds.feedburner.com/computeractionshowvideo
#    exists: /media/freenas/podcasts/The Linux Action Show! Video/
#    download: /media/freenas/podcasts/The Linux Action Show! Video/

  unfilter HD:
    rss: http://www.jupiterbroadcasting.com/feeds/unfilterHD.xml
    exists: /media/freenas/podcasts/unfilter HD/
    download: /media/freenas/podcasts/unfilter HD/

  Linux Action Show Torrent:
    rss: http://www.jupiterbroadcasting.com/feeds/lasstorrent.xml
    exists: /media/freenas/podcasts/The Linux Action Show! Video/
    set:
      transmission:
        enabled: yes
      path: /media/freenas/podcasts/The Linux Action Show! Video/

  TechSNAP Torrent:
    rss: http://www.jupiterbroadcasting.com/feeds/TechSNAPTorrent.xml
    exists: /media/freenas/podcasts/TechSNAP Large Video/
    set:
      transmission:
        enabled: yes
      path: /media/freenas/podcasts/TechSNAP Large Video/

presets:
  global:
    accept_all: yes
    limit_new: 2
    transmission:
      host: localhost
      port: 9091
      username: transmission
      password: transmission
      honourlimits: yes
      maxdownspeed: 200
      maxupspeed: 20
      enabled: no

Now test it:


flexget --check
flexget --test

Mark all current feed items as seen


flexget --learn

Download one feed


flexget --feed "unfilter HD"

Unmark feed as seen

flexget --forget "unfilter HD"

Add it to cron


/usr/bin/nice -n19 /home/leon/.local/bin/flexget --cron

]]>
http://v3.vanutsteen.nl/2012/07/16/installing-using-flexget/feed/ 0
motorrijweer.nl http://v3.vanutsteen.nl/2012/03/16/motorrijweer-nl/ http://v3.vanutsteen.nl/2012/03/16/motorrijweer-nl/#comments Fri, 16 Mar 2012 18:28:59 +0000 LeonB http://www.vanutsteen.nl/?p=659 Ik heb de eerste versie van motorrijweer.nl live gezet! ‘t Is nog vrij basis maar je kunt wel al voor een paar regio’s het motorweer/motorrijweer opvragen. Op naar de volgende versies!

Motorrijweer / motorweer

]]>
http://v3.vanutsteen.nl/2012/03/16/motorrijweer-nl/feed/ 0
Sublime Text 2 http://v3.vanutsteen.nl/2011/10/26/sublime-text-2/ http://v3.vanutsteen.nl/2011/10/26/sublime-text-2/#comments Wed, 26 Oct 2011 21:36:30 +0000 LeonB http://www.vanutsteen.nl/?p=562 I installed sublime text on my Ubuntu 11.10 box but I had some troubled loading external python modules:

loaded 937 snippets
>>> import distutils
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named distutils

This is how I solved it:

Edited ~/.local/share/applications/sublime.desktop
Especially this line:

Exec="/home/leon/Software/bin/sublime" %U

/home/leon/Software/bin/sublime contains this:

#!/bin/bash
cd /usr/lib/python2.7
/home/leon/Software/SublimeText2/sublime_text

Then I installed some excellent plugins:

]]>
http://v3.vanutsteen.nl/2011/10/26/sublime-text-2/feed/ 0
Lsyncd http://v3.vanutsteen.nl/2011/08/09/lsyncd/ http://v3.vanutsteen.nl/2011/08/09/lsyncd/#comments Tue, 09 Aug 2011 21:50:19 +0000 LeonB http://www.vanutsteen.nl/?p=525 FreeBSD rsync configI was messing around with some python script to test a spamassassin install. It checks al the mail in the spam folder an see if it is marked as spam. Then it goes through the mail in ham/ and see if it passes as not-spam.

So I’m developing it on my local computer but I wanted to test it on a remote server. Well, actually not that remote because I can touch it from where I’m sitting but that’s not the point :) The point was that I needed something to keep the remote version of the sourcecode in sync with the local source. Google to the rescue and I found lsyncd.

A nice little tool to sync two directories with rsync. Too bad it didn’t support transfers only via sftp because freebsd (the remote server) doesn’t come with rsync installed. So I had to install that also :( Yeah, tough job….

cd /usr/ports/net/rsync
make config
make install

Then on the local machine:

lsyncd --no-daemon --delay 1 ~/Workspaces/spamassassin-test/ beastie:~/spamassassin-test/

You have to specify the remote directory or else it will wipe you home folder as I discovered…

After this was done I could go on developing.

]]>
http://v3.vanutsteen.nl/2011/08/09/lsyncd/feed/ 0
installing macvim with python interpreter http://v3.vanutsteen.nl/2010/04/10/installing-macvim-with-python-interpreter/ http://v3.vanutsteen.nl/2010/04/10/installing-macvim-with-python-interpreter/#comments Sat, 10 Apr 2010 13:43:02 +0000 LeonB http://www.vanutsteen.nl/?p=482 As easy as: sudo port install macvim +python :)

]]>
http://v3.vanutsteen.nl/2010/04/10/installing-macvim-with-python-interpreter/feed/ 0
python libindicate http://v3.vanutsteen.nl/2009/10/19/python-libindicate/ http://v3.vanutsteen.nl/2009/10/19/python-libindicate/#comments Mon, 19 Oct 2009 20:18:53 +0000 LeonB http://www.vanutsteen.nl/?p=421 I saw that there are python bindings for libindicate. They’re called “python-indicate“.

There’s also a wiki about this new feature from Ubuntu. I thought about creating a plugin for weechat that uses this library. Especially because the notify-plugins is useless if you’re away and somebody mentions you on irc. Libindicate would be perfect for this. First have to find out how the behaviour of the applet would be.

[update]
I asked my question on the libindicate launchpad so I’m very curious about the answer(s).
[/update]

messaging-menu-karmic ubuntu 9.10 libindicate

]]>
http://v3.vanutsteen.nl/2009/10/19/python-libindicate/feed/ 0
Weechat 0.3.0 on Ubuntu 9.10 http://v3.vanutsteen.nl/2009/10/18/weechat-0-3-0-on-ubuntu-9-10/ http://v3.vanutsteen.nl/2009/10/18/weechat-0-3-0-on-ubuntu-9-10/#comments Sun, 18 Oct 2009 20:58:34 +0000 LeonB http://www.vanutsteen.nl/?p=415 Ubuntu 9.10 comes with an older version of weechat. So I downloaded the stable release 0.3.0 and installed it:

./configure --prefix=/home/leon/Software/local/ --enable-gtk --enable-demo
make
make install

Note: gtk is not very usable so you better use the ncurses interface!

I wrote a little plugin for it that autosaves the current connected channels and enables autojoin for them. It can be found on my github page and on the plugins page of weechat (if FlashCode aprobes the new version 0.2).

And here a nice plugin of weechat in action with the autojoin plugin (Nice!!):

Screenshot of weechat in action

]]>
http://v3.vanutsteen.nl/2009/10/18/weechat-0-3-0-on-ubuntu-9-10/feed/ 0
Choosing a new editor: Emacs vs. Vim http://v3.vanutsteen.nl/2009/10/15/choosing-a-new-editor-emacs-vs-vim/ http://v3.vanutsteen.nl/2009/10/15/choosing-a-new-editor-emacs-vs-vim/#comments Thu, 15 Oct 2009 07:27:49 +0000 LeonB http://www.vanutsteen.nl/?p=393 For php I use Zend Studio for Linux. We have a license at work for it and it is in my opinion the best editor for php. It’s relatively fast and you can use it to quickfix php over an ftp connection.

For Ruby I use netbeans. I would also like to use it for php but it doesn’t allow to quicly open a file via ftp/scp or whatever. And it can sometimes be sloooooowwww. I’ve  seen netbeans used on a Windows platform and there it is much faster.

When I right-click on a project in netbeans for the first time, it takes 5 seconds (not lying!) to render the popup-menu. Come onm take forever!

And because I was now developing with Python I decided to try a new editor. Something more hardcore and lighter. Something nerdy :) So ofcourse I only have two decent options: Vim & Emacs.

I already had try them with Ruby. But I found good Ruby (& Rails) support rather lacking by both of them. I believe that the python comminity is more hardcore and therefore are using more arcane editors :) And maybe because they aren’t afraid to hack away in another language than their own (lisp, vimscript).

I think I have been comparing the two editors for nearly two weeks now. I have spent hours and hours comparing, trying and browsing for blog posts about the two. At the end, I really didn’t know which one to choose. I really suck at deciding something :) So I made a little list of what I find to be strong points of each editor:

VIM:

  • Better syntax highlighting/theming supprt (wombat ftw!!)
  • Faster/smaller
  • No weird handling of new buffers like with emacsclient
  • No daemon like: emacs –daemon
  • Better python integration
  • Easier to make extensions
  • Preview of docstrings when using omni completion

EMACS:

  • Better python-mode
  • No commandmode/normalmode
  • Directory browser/editor
  • Debugger (better integration with external tools)
  • easier to begin
  • Everyting is a buffer™

And now I have chosen to be the editor with which I am going to work is…… (drum roll please) …….:

Gedit!

No, it’s (g)Vim :)

And while writing this article I was looking for a WordPress/blog plugin for Vim and Emacs. At a glance it looked like the wordpress plugin for Emacs was a little bit better. So already I was doubting my decision… So it could be that I switch editor in the next few months :) But I’m first going to really use gvim to see if it fits with my workflow and is really useable for me.

As cherry on the pie, a nice screenshot of my gvim in action:

Vim with python-mode

[update]
I’ve installed Netneans 6.8m2 and it feels a lot faster than 6.7 but python completion is as bad as in 6.7.
[/update]

[update2]
Found out about Vim’s netrw. So Emacs no longer got “Directory browser/editor” as a strong point.
[/update2]

]]>
http://v3.vanutsteen.nl/2009/10/15/choosing-a-new-editor-emacs-vs-vim/feed/ 2
Rmp -> Pmpd http://v3.vanutsteen.nl/2009/09/24/rmp-pmpd/ http://v3.vanutsteen.nl/2009/09/24/rmp-pmpd/#comments Thu, 24 Sep 2009 05:40:00 +0000 LeonB http://www.vanutsteen.nl/?p=362 monty-pythonI’ve ditched Ruby for my mpd project and started using Python. Not that I like python that much more but the Gstreamer library for python is much more complete. I really wanted gapless playback and the Ruby Gstreamer libray just doesn’t support that. If it does by the time you read this: please let me know :)

The new Pmpd project (looking for a better name) can be found on github. The hardest part so far is having to restructure the sources. Python is not a difficult language to master at all but I’m very picky on how everything fits together. My ruby project felt right on that part. But the python equivelant has some things I just don’t like enough up to now.

]]>
http://v3.vanutsteen.nl/2009/09/24/rmp-pmpd/feed/ 0