Archive for January, 2011

from unix-time, to unix-time, sql examples

Thursday, January 20th, 2011

 

mysql> select now();
 +---------------------+
 | now()               |
 +---------------------+
 | 2009-01-31 21:54:36 |
 +---------------------+
 1 row in set (0.00 sec)

 

mysql> select unix_timestamp(now());
 +-----------------------+
 | unix_timestamp(now()) |
 +-----------------------+
 |            1233435200 |
 +-----------------------+
 1 row in set (0.00 sec)
mysql> select from_unixtime(1233435200);
 +---------------------------+
 | from_unixtime(1233435200) |
 +---------------------------+
 | 2009-01-31 21:53:20       |
 +---------------------------+
 1 row in set (0.00 sec)
mysql> select count(*) from sessions where timestamp > unix_timestamp(now() - interval 31 day);
 +----------+
 | count(*) |
 +----------+
 |     8711 |
 +----------+
 1 row in set (0.06 sec)
mysql> select count(*) from sessions where timestamp > unix_timestamp("2009-01-01 00:00:00") and timestamp < unix_timestamp("2009-01-31 00:00:00");
 +----------+
 | count(*) |
 +----------+
 |     8407 |
 +----------+
 1 row in set (0.08 sec)
more info: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

File duplikációk megszüntetése az fdupes segítségével

Thursday, January 6th, 2011

Az alábbi példa kitöröl minden file ismétlődést a megnevezett könyvtárakból, tehát ha olyan filet talál aminek a tartalma megegyezik egy már korábban vizsgált file tartalmával, akkor törli azt, íly módon minden fileból csak az először megtalált példány marad meg.

fdupes -r -d -N /store /incoming

A program elérhető linux és windows (cygwin) alatt is.

http://en.wikipedia.org/wiki/Fdupes