Archives: April 2014

The Pitivi team still needs our help for bringing their simple to use open source video editor to a professional level. The campaign has past half of its goal and counting...

La Quadrature Joins the Legal Struggle Against Mass Surveillance

La Quadrature du Net joins the legal struggle against mass surveillance. Most so-called democratic western governments are trying to legalise massive surveillance under the pretence of fighting terrorism and child abuse.

Delete lines containing a specific string with sed

The following command makes sed delete every lines containing the matching pattern from the file named foo. If this file is important, we make sure to back it up first!

$ sed -i '/pattern/d' /path/to/foo

The -i flag (GNU version only) edit the file in-place. For non-GNU version, we can redirect the output with >.

$ sed '/pattern/d' /path/to/foo > /path/to/foo

Avaaz petition to protect Sumatra's rainforest and its orangutans

Help protect Sumatra's rainforest and its orangutans by sending a message to ambassador Olof Skoog.

MariaDB / MySQL: export or backup data to a CSV file

It seems there are several ways to do this. Here is one, using the mysql prompt. I used mysql root account because my usual user has not enough permissions to write files (ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES)), even after a chmod 777: UPDATE: We need to grant file access to the database user:

$ mysql -u root -p
Enter password:
[...]
MariaDB [(none)]> GRANT FILE ON *.* TO 'username'@'localhost';

GRANT ALL does not include file permission. Now we can execute a query and output it into a CSV file. Formatting options are available:

$ mysql -u username -p database_name
MariaDB [database_name]> SELECT field1, field2, field3 INTO OUTFILE 'database_name_export.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY 'n' FROM table_name;

Not specifying a path put the file in /var/lib/mysql/database_name. When I use /tmp/database_name_export.csv, the file is written in /tmp/systemd-private-14da7...-mysqld.service-.../tmp/. This behaviour happens on an encrypted Arch Linux system.

Also note that mysql won't overwrite an existing file, for security reason: ERROR 1086 (HY000): File '/tmp/database_name_export.csv' already exists.

Source

Source update