Archive

Archive for December, 2014

2014 in review

December 30, 2014 Leave a comment

The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.

Here's an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 150,000 times in 2014. If it were an exhibit at the Louvre Museum, it would take about 6 days for that many people to see it.

Click here to see the complete report.

Advertisements
Categories: Uncategorized Tags: ,

media info

December 28, 2014 Leave a comment

Problem
You have a media file (audio, video, image) and you want to get some detailed information about it: duration, bit rate, resolution, etc. How to extract these pieces of information?

Solution
Use the MediaInfo project. You can install it via your package manager and you will get a command called “mediainfo”.

Example:

$ mediainfo movie.avi

Output:

General
Complete name                            : movie.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
Format profile                           : OpenDML
Format settings                          : rec
File size                                : 1.27 GiB
Duration                                 : 2h 29mn
Overall bit rate                         : 1 218 Kbps
Writing application                      : AVI-Mux GUI 1.17.8.3, Feb 16 201019:42:50

Video
ID                                       : 0
Format                                   : MPEG-4 Visual
Format profile                           : Advanced Simple@L5
Format settings, BVOP                    : 2
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Muxing mode                              : Packed bitstream
Codec ID                                 : XVID
Codec ID/Hint                            : XviD
Duration                                 : 2h 29mn
Bit rate                                 : 1 086 Kbps
Width                                    : 720 pixels
Height                                   : 304 pixels
Display aspect ratio                     : 2.35:1
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.207
Stream size                              : 1.13 GiB (89%)
Writing library                          : XviD 64

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Mode                                     : Joint stereo
Mode extension                           : MS Stereo
Codec ID                                 : 55
Codec ID/Hint                            : MP3
Duration                                 : 2h 29mn
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 136 MiB (11%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 747 ms (17.92 video frames)
Interleave, preload duration             : 216 ms
Title                                    : mp3
Writing library                          : LAME3.99r
Encoding settings                        : -m j -V 4 -q 2 -lowpass 17 -b 128

Python
There is a simple Python wrapper for it called pymediainfo. Its github page is here.

Categories: bash, python Tags: , , ,

Getting started with the Rust programming language

December 24, 2014 Leave a comment

I heard a lot of good things about Mozilla’s Rust prog. language, so I decided to give it a try. A very nice starting point is The Rust Guide.

Installation

$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh

I modified this script a little bit:

#!/bin/sh

DEST=/tmp

cd $DEST
rm -f $DEST/rustup.sh
wget https://static.rust-lang.org/rustup.sh -O $DEST/rustup.sh
sudo sh $DEST/rustup.sh

But it does the same thing. If you install Rust via this rustup.sh script, it has two advantages: (1) it installs the latest version of Rust, and (2) it also installs Cargo, the package manager and build system of Rust.

Print the version number: “rustc -V“.

Hello World

// hello_world.rs
fn main() {
    println!("Hello, World!");
}

Compile it with “rustc hello_world.rs“.

Troubleshooting
Under Ubuntu I had no problems, but under Manjaro got the following error: “rustc: error while loading shared libraries: librustc_driver-4e7c5e5c.so: cannot open shared object file: No such file or directory“.

Solution #1
Add the following line to your ~/.bashrc:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib

Solution #2
Create the file /etc/ld.so.conf.d/rust.conf with the following content:

/usr/local/lib

Then execute the command “ldconfig” as root.

More info
Check out The Rust Guide.

Categories: manjaro, programming language, ubuntu Tags:

visit freenode IRC channels in your browser

December 23, 2014 Leave a comment
Categories: Uncategorized Tags: , ,

extracting conky settings from Parted Magic

December 19, 2014 Leave a comment

Two days ago I heard about Parted Magic, which is a live Linux CD offering a complete hard disk management solution. As I was checking out the screenshots, I noticed that it has a beautiful conky setting:

“I need that” was my first reaction :) So I grabbed a copy of Parted Magic, launched it in VirtualBox, and extracted the conky configuration. You can download it from here. My launcher script is here. Simply add the launcher to the list of startup applications.

Tip: if you want to play with conky, do it with Conky Manager. Here is how to install it.

convert .txt to .pdf

December 15, 2014 Leave a comment
pandoc input.txt -o output.pdf

By the way, pandoc can convert from / to lots of file formats.

Categories: bash Tags: , ,

shuffle the lines of a file

December 15, 2014 Leave a comment
cat file.txt | shuf

For more alternatives, see the comments at the bottom of this page.

Update (20151014)
The command sort has an option “-R“, which does the same:

sort -R file.txt
Categories: bash Tags: ,