List Unfinished Tasks in Moodle (ucilnica.*.uni-lj.si)

If you hate Moodle, often miss homework deadlines or if you’re constantly checking if there are any tasks you haven’t finished, this is just the thing for you! :)

After installing, just type “todo” in your terminal, and your unfinished tasks will be listed for you.

Source: https://github.com/hamax/moodle-todo

Quick start:
- install Python – Beautiful Soup (>= 3.1)
- download one and only source file: https://github.com/hamax/moodle-todo/raw/master/todo.py
- set your username and password in todo.py (or make a config file ~/.moodle-todo.conf)
- (optional) add it to PATH (I recommend making a link in /bin)
- run it ;)

Surviving without Apache (with Nginx, mod_wsgi and php-cgi)

This tutorial is very simple, anyone with basic understanding of linux should be able to get it up and running.
(this blog and everything else on hamsworld.net is running on this configuration)

Side note: If you don’t want to compile nginx and/or want a more stable solution consider gunicorn.

  • Download nginx and mod_wsgi from the web and extract them
wget http://nginx.org/download/nginx-0.8.53.tar.gz
whet http://bitbucket.org/lifeeth/mod_wsgi/get/6975f0ec7eeb.gz
tar xvzf nginx-0.8.53.tar.gz 6975f0ec7eeb.gz
  • Make sure there are folders “nginx-0.8.53″ and “mod_wsgi”
  • Install nginx (you will need gcc, libssl-dev and libpcre3-dev packages installed, you can just apt-get install them)
cd nginx-0.8.53
./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --add-module=../mod_wsgi/ --with-debug
make
sudo make install
cd ..
  • Install mod_wsgi
cd mod_wsgi
sudo python setup.py install --sbin-path=/usr/sbin --conf-path=/etc/nginx
cd ..
  • Configure nginx

Go to /etc/nginx/ and create a directory sites or something like that for per virtual server configs and then edit your nginx.conf to something like that:

user    www-data;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    #gzip  on;

    wsgi_python_optimize 0;
    #wsgi_python_executable /usr/bin/python;
    #wsgi_python_home /usr/;
    wsgi_enable_subinterpreters on;

    include /etc/nginx/sites/*;
}

Django or other wsgi (you’ll need django.wsgi file from here http://docs.djangoproject.com/en/1.2/howto/deployment/modwsgi/):

server {
    listen       80;
    server_name  www.example.com; #change this

    location /media/ {
        root   /path/to/django/project/; #change this; without media at the end
    }

    location / {
        wsgi_pass /path/to/django/project/django.wsgi; #change this

        include wsgi_vars;

        wsgi_pass_authorization off;
        wsgi_script_reloading on;
        wsgi_use_main_interpreter on;
    }

}

WordPress:

server {
    listen 80;
    server_name www.example.com; #change this
    root /path/to/wordpress/; #change this
    index index.php;

    try_files $uri $uri/ /index.php?q=$uri&$args;

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}

Other PHP:
Same as wordpress, just delete the try_files if you don’t want it (it redirects everything that doesn’t exist to index).

IRC Scripts and Bots and stuff and things

Some cool IRC stuff that I made during this weekend:

XChat script, that lowercases “caps-lock retard” messages: ShikiScript (unzip it first)
You can place it in ~/.xchat2/ for automatic loading on every start or just load it with the xchat GUI: Window -> Plugins and Scripts

Modules for pyfibotIRC bot written in python:
module_joke: gets a random joke (.joke)
module_wiki: does a google search (.search/.s – they are not the same thing) or displays the first paragraph of wiki article (.wiki/.w – they are the same thing)

If you want to see it in action, you can join #hamsworld@irc.freenode.net:8001 (you can use this webchat).

Enhanced by Zemanta

Broken Samsung 22″ Display

This story is way shorter, and not so educational, as the Asus EEE one, but it does suggest that I’m not lucky with any lcd displays – big or small.

So I had this Samsung 226BW display and it was great up until the day it decided that it had it, and that it won’t display my video anymore  (black screen – not even the detecting signal thingy was there).
So I opened it…

…figured out I don’t know much about electronics…

…and bought a new one (Philips 241E1SB E-Line).

Maybe replacing the power supply would work, but I don’t know. New power supply from China would cost 30€.

Now I’m off to watching some full HD animes (It sure gonna feel different on full HD resolution compared to 1680×1050 – before you start commenting know that this was sarcasm) :D
The main thing is that I can work, chat, browse, tweet, etc. at the same time again without going crazy.

p.s. There was some sticker saying something like “compatible with win 7″, but I have no idea what happed to it :P

APE-Project How To: Build Server-Side Module in C to use with Javascript

Building a server-side javascript module is documented here (http://www.ape-project.org/wiki/index.php/How_to_create_a_server_Module), while building server-side modules in C is considered deprecated or at least not the best idea (it is not documented at all!). Programing in javascript is all fancy and stuff, but what are you supposed to do if you need Postgres, Memcached or something like that? For C (and C++) there is tons of libraries available, APE-Project is based on C, so maybe we could do something about that. Read on if you’re interested.

Continue reading ‘APE-Project How To: Build Server-Side Module in C to use with Javascript’ »

Reboot to Windows shortcut for Ubuntu 9.10+ (Grub 2)

If you’re dual booting Ubuntu and Windows, a simple shortcut “reboot to windows” might come in handy, so you don’t have to stare at the screen waiting for the boot loader to show up.

This shortcut sets Windows as default grub option only for one reboot, so next time you start up the pc or reboot it from windows the default is back to Ubuntu.

Step By Step:
1. Open terminal (Applications -> Accessories -> Terminal)
2. Type “sudo gedit /etc/default/grub” and hit return
3. Change “GRUB_DEFAULT=0″ (or whatever the value is) to “GRUB_DEFAULT=saved” (you might also want to lower the GRUB_TIMEOUT value)
4. Save & Close gedit
5. Type “gedit ~/win-reboot.sh” and paste the following code into gedit (change ”Windows 7 (loader) (on /dev/sda1)”  to the name or number of your Windows option in grub, you can check that by serching for windows keyword in /boot/grub/grub.cfg)

#!/bin/bash
grub-reboot "Windows 7 (loader) (on /dev/sda1)"
reboot

6. Save & Close gedit
7. Type “chmod +x ~/win-reboot.sh” to allow execution of this file
8. Type “sudo update-grub” to apply changes to grub configuration
9. Type exit or hit Ctrl+D to close the terminal

–If you are using Gnome (default Ubuntu desktop) you can proceed to step 9 to create the shortcut, but ~/win-reboot.sh should work already–
10. Right click on a gnome panel and select “Add to panel”
11. Select “Custom Application Launcher” and click “Add”
12.  Fill out the form like this (replace “/home/ziga/” with your home directory, you can find that out by opening terminal and typing “cd;pwd”):

Windows Reboot Launcher Properties
13. Click the shortcut, type your password and let it work

Please comment if you encounter any problems or have any additional questions.

EDIT (Thanks to Arttu): added update-grub step and changed the script to use grub-reboot

#!/bin/bash
grub-set-default “Windows 7 (loader) (on /dev/sda1)”
sed -i s/’${chosen}’/0/g /boot/grub/grub.cfg
reboot
Enhanced by Zemanta

Replacing LCD on Asus Eee 1000H

Yeah, I broke my eee’s lcd -.- hardware yay… not :P

I’ve ordered one from ebay two weeks ago and got it today. They’ve charged me extra 17€ for vat and some other unknown expenses >.< But anyway, here it is:

eee - new lcd

Next step, of course, is to disassemble eee immediately!

eee - boomkaboom eee - motherboard motherboard (PCB MADE IN CHINA)

Throw the old lcd away, connect the new one… and…

eee - too big this lid is too small!!! eee - yay false alarm :P

And thats all. Pretty simple. Just connect the keyboard back with fancy connectors, screw back some screws…

eee - final whoa, looks like eee again (got keyboard working in 2nd try)

Now I only hope that this one will stay in one piece for a while (current record is less than 1 year).