Archive for July, 2013

Bebiko Junior competition (

16/07/2013 Leave a comment

Friend of mine participate in competition on – just a simple vote system. Unfortunately I can’t see on which place she is, there is no such a functionality, so I need to implement it by myself. As usual I choice php for that:

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$in = curl_exec($ch);

preg_match_all('/data-votes="(.*)" data-name="(.*)" data-id/i', $in, $out);
        echo $out[2][$i].';';
        echo $out[1][$i]."\n";

It will output a list of nicknames and votes in format:
Afterwards that output can be imported to excel and sorted.

Btw. Don’t forget to vote!

Categories: Bash

Backup remote server using tar and ssh

13/07/2013 1 comment
ssh user@server "sudo tar cvzp - / --same-owner --exclude=/proc/* --exclude=/media/* --exclude=/dev/* --exclude=/mnt/* --exclude=/sys/* --exclude=/tmp/* --ignore-failed-read" > backup.tgz

user should have sudo rights without password on remote machine.

Categories: Linux, Useful commands