tip’ Entries

  • Block comenting python code in vim

    Recently, I find myself wanting to do block commenting for my python scripts more and more often. Sometimes just to hide a piece of code, or disable it while I'm debugging etc.

    Of course, in python the best way to do this is by putting a `#` at the start of the line, but this process can be quite tedious if you have lots of code you wish to comment. I decided to let vim do the work for me.

    I placed the script in my vim plugins folder, and then mapped F6 to the BlockComment() call, …

    Read More …


  • Resetting your django password

    Today, I came back to a site that I have not been working on for over a month, and to my shock, I could not remember my password for the site. This was driving me nuts for a while, until I decided to just change it with some python code. The cool thing is that you can do this directly from your shell.

    So if you ever forget your django password, here is how you can change it:

    First we run our django/python shell:

    python manage.py shell

    Now that we have our interactive shell, we …

    Read More …