2013-04-07

Default Sudo lecture

Here is a standard Sudo lecture, which can be seen at the user's first sudo run time (the following is an unmodified quote extracted from the sudo-$VERSION/plugins/sudoers/check.c source file found in the original sudo 1.8.6p7 source tarball):
#define DEFAULT_LECTURE "\n" \
    "We trust you have received the usual lecture from the local System\n" \
    "Administrator. It usually boils down to these three things:\n\n" \
    "    #1) Respect the privacy of others.\n" \
    "    #2) Think before you type.\n" \
    "    #3) With great power comes great responsibility.\n\n"
References:
  1. Sudo Main Page

2013-03-10

HOWTO: losslessly convert FLV video to MP4 in Linux (Debian)

Well, let's imagine we have a Flash Video (FLV/F4V) container file (possibly "unseekable" or with other minor problems) containing MPEG-4 AVC video & AAC (or MP3) audio.

We'll convert ("remux") it to MP4 without any transcoding (re-encoding), so it'll be very fast, and using only the free tools (available in the official Debian GNU/Linux repositories).

Note: unfortunately, old FLV videos containing VP6 and Sorenson video formats can't be remuxed into MP4 format; if you don't want re-encoding, you can try to remux them into MKV (Matroska); if you just want to fix the seek problems, you can just try FLV-to-FLV remuxing.

  • Method #1 (recommended): use ffmpeg (it's the main utility from the FFmpeg project).
    Install the "ffmpeg" package:
    # apt-get install ffmpeg
    Convert a FLV file to MP4, preserving audio & video:
    $ ffmpeg -i input.flv -codec copy output.mp4
    And even optimizing it for faster loading:
    $ ffmpeg -i input.flv -codec copy -movflags faststart output_optim.mp4
    To extract audio only:
    $ ffmpeg -i input.flv -codec copy -vn output_a.mp4
    To extract video only:
    $ ffmpeg -i input.flv -codec copy -an output_v.mp4
    Note: you can also use M4A (audio) / M4V (video) file extensions for output, if you like those Apple formats.
  • Method #2 (alternative): using avconv (it's a part of Libav project, a fork of FFmpeg).
    Install the "libav-tools" package:
    # apt-get install libav-tools
    Convert a FLV file to MP4, preserving audio & video:
    $ avconv -i input.flv -codec copy output.mp4
    To extract audio only:
    $ avconv -i input.flv -codec copy -vn output_a.mp4
    To extract video only:
    $ avconv -i input.flv -codec copy -an output_v.mp4
  • Method #3 (a somewhat ugly one): using MEncoder (a part of the MPlayer project).
    Install MEncoder:
    # apt-get install mencoder
    Convert a FLV file to MP4:
    $ mencoder input.flv -ovc copy -oac copy -of lavf -o output.mp4
    Note: according to the warning from MEncoder itself, output file can be corrupt:
    ** MUXER_LAVF *****************************************************************
    REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
    INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
    will play these INCORRECT files as if nothing were wrong!
    *******************************************************************************
    So probably it suggests that you should better try the MEncoder's favorite AVI format:
    $ mencoder input.flv -ovc copy -oac copy -o output.avi
    (But that's not what we want here, right?)

Source software packages availability for Debian releases:
  • ffmpeg: up to Debian 6 "Squeeze", and then again from 9 "Stretch" (also in 8 "Jessie" backports);
  • libav: starting from 7 "Wheezy" (also in 6 "Squeeze" backports), up to 8 "Jessie";
  • mplayer: up to 7 "Wheezy", and then from 9 "Stretch".

And yes, it should work for Ubuntu too; any current FFmpeg version should also work in other GNU/Linux or *BSD distros, MS Windows, Apple Mac OS X etc.

References:
  1. ffmpeg Documentation
  2. Libav documentation : avconv
  3. 6.1. Selecting codecs and container formats - Chapter 6. Basic usage of MEncoder (MPlayer - The Movie Player documentation)
  4. Wikipedia:
    1. Flash Video
    2. MPEG-4 Part 14
    3. M4V
    4. H.264/MPEG-4 AVC
    5. Advanced Audio Coding
    6. Audio Video Interleave
---
Last updated: 2017-12-28

The Simpsons: Cisco

HOWTO: make MS VS 2005 work with WPF etc.

WPF ("Windows Presentation Fundation", just another MS Windows GUI API from .NET 3.0 "WinFX", this time XML-based) is fully supported in Microsoft Visual Studio 2008 and newer.
If you use VS 2005, you'll not find an option to create a WPF project from the New Project dialog (WPF was released as part of .NET Framework 3.0, while VS 2005 is for .NET 2.0).

Here are the required steps to get an ability to build WPF projects with VS 2005.
  1. Download .NET Framework 3.5 SP1 (if you don't have an up-to-date .NET 3.x version installed yet).
  2. Download a small add-on for VS 2005:
    Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP
    Mirror: CNET | Download.com
    Note: MS has released that package as a CTP ("Community Technology Preview", MS' term for some kind of beta / preview SW releases); it's unsupported, so upgrade to VS 2008 or later is recommended.
  3. Install the downloaded MSI package.
    If the installer exits with an error (regarding the bad / already installed / newer .NET version), you should start it manually (i. e., from MS Windows Command Prompt, you know: <Win>+<R>, cmd, <Enter>) with a specific option:
    > cd P:\ath\To\Installer\Folder
    > msiexec /i vsextwfx.msi WRC_INSTALLED_OVERRIDE=1
    It allows to ignore that error and continue the installation process.
  4. After that, a new option titled Windows Application (WPF) should appear as part of (new!) .NET Framework 3.0 subcategory for C# language in the New Project dialog of the Studio.
    Enjoy!

See also:
  1. Visual Studio 2005 extensions for .NET Framework 3.0 (WF)
  2. Wikipedia: WCF / WPF / WF | .NET Framework

2013-02-05

JDownloader download manager

JDownloader is a very nice download manager:
  • it's a freeware (open source, though with some closed source parts);
  • it's written in Java, which doesn't make it super-fast, but cross-platform instead (runs well on MS Windows, GNU/Linux & Apple Mac OS X);
  • it allows [semi-]automated downloads from a lot of popular websites (i. e.: file sharing/"cloud" services, social networks, photo/music/video hostings etc.; the use of "premium" accounts is also possible).

Custom (manual) installation notes (primarily for GNU/Linux and other Unix-like OS users).
  1. Please install an up-to-date JRE (Java VM environment).
  2. The current major release is called "JDownloader 2". Go to the official download page and select the "Other" version for download.
  3. You should have a single file downloaded (JDownloader.jar). Please put into your favorite installation directory (e. g.: ~/Applications/JDownloader).
  4. Just run it (see below), and it should even auto-update itself!

Custom application launch notes.
  • Here is a sample shell script:
    #!/bin/sh
    cd ~/Applications/JDownloader
    java -Xmx512m -jar JDownloader.jar
    
  • The -Xmx Java option means the maximum allowed runtime RAM allocation (in this example, 512 MiB).
  • You can save it as JDownloader.sh on your desktop, or wherever you like (or even execute the commands manually, if you like).

Custom configuration notes.
  • In case the fonts in your JDownloader setup are displayed too small, you can try changing the configs:
    1. go to Settings → Advanced Settings;
    2. type "font" into the Filter Settings search box;
    3. increase the value of the "LAFSettings: Font Scale Factor" key (e. g., from the default 100 [percent] to something like 150);
    4. restart JDownloader.

P. S. Anyway, please be nice & respect the [copy-]rights of others ;-)

---
Last updated: 2018-10-10