These are software packages that make my life easier. I use the GNU/Linux operating system, but most or all of these are available for other operating systems too.
Here's a command to add a comment to an Ogg Vorbis audio file:
vorbiscomment -a Ciaran_O\'Riordan_-_End_Software_Patents_-_LibrePlanet_2009.ogg -t "comment=Transcript: http://groups.fsf.org/index.php/Ciaran_O'Riordan_(LP09)"
Convert track 1 of a CD to ogg via pipe:
cdparanoia 1-1 - | oggenc -q 3 -o track-01.ogg - ; done
And to do that for a CD of 20 tracks:
for i in `seq -w 1 20`; do cdparanoia ${i}-${i} - | oggenc -q 3 -o track-${i}.ogg - ; done
gs -sPAPERSIZE=a4 -sDEVICE=pnmraw -r300 -dNOPAUSE -dBATCH
-sOutputFile=- -q input.pdf | ocrad > output.text
There's an article about a more thorough method here: How To Extract All Text From PDFs (Including Text In Images).
Here's a command which operates on all .pdf files in the current directory. It replaces any spaces in the filenames with underscores.
find . -maxdepth 1 -iname '*.pdf' | while read n; do mv
"$n" `echo "$n" | sed 's/ /_/g'`; done
I have two files with lists of words, each has one word per line, and I want to run a command based on all combinasions of those two lists. For a practical example, there's a website that posts videos each day, but they don't provide a convenient way to download them. The file names are different each day, but many use a recurring set of words used to form the file names, so if I try all those combinations, I'll get a few videos each day.
cat prefixes | while read p; do cat suffixes | while read s; do wget -c http://videos.gmanews.tv/2010a/03/${p}_030710_${s}.flv; done ; done
In this example, I'll also have to change the date (mmddyy).
To play a file at 1.7 times normal speed with mplayer:
mplayer -af scaletempo=scale=1.7 the_file.oggThis increases the playback speed without increasing the pitch.
To play a video at increased speed, while keeping the audio and video in sync,
you have to launch mplayer with the following command, and then use the keys
"]", "}",
"[", and "{".
mplayer -af scaletempo=scale=1 the_file.webmIf you set the initial speed to something other than 1, the video will be out of sync. If you launch mplayer without the scaletempo option, when you increase the speed you'll change the pitch of the audio.
More info here.
This is a command I used to make a HTML table so I could see what the timestamp on my audio file turns into when I'm listening with the speed increased by 70%. (See mplayer speed commands.)
for i in `seq 1 100`; do echo \<tr\>\<td\>$((${i} / 60)):$((${i} % 60))\</td\>\<td\>$(( $(( $((${i} * 10)) / 17)) / 60)):$(( $(( $((${i} * 10)) / 17)) % 60))\</td\>\</tr\>; done
If you've audio or video files where the volume is too low, mplayer can amplify them with this command:
mplayer -softvol -softvol-max 1000 file.ogg
When you play the file, the volume will be at the normal (low) level, but by
hitting * you can increase the volume to 1000% of the normal
maximum. To decrease the volume, hit /.
If you want to run, say, GIMP in Spanish, you can lauch it with this command from a shell command line:
LANGUAGE=es_ES gimp
For some commands such as "date", you use "LANG" instead
and you can only use the languages of "locales" that are installed
on your system. To see the list of locales, type:locale
-a
LANG=nl_BE.utf8 date
And if you want to specify a list of preferences, there's info in the glibc manual. This is for if you want designate, say, Dutch as your primary language, and French as your second language. If you only set one preference, then you'll always get the default (English) when something isn't translated to your preferred language.
Here's the command I used to get the audio from a .flv video:
mplayer rozemarijn.flv -dumpaudio -dumpfile rozemarijn.mp3
When mplayer is given the dumpaudio command, it dumps an exact
copy of the audio data that's in the original file. No conversion is done
and no data is lost, so you can do this infinitely without degrading the
audio. This also means that you don't choose the format of the resulting
audio file. In this case, I knew the audio in the .flv file was in the MP3
format, so I gave the output file a name ending in ".mp3". I
could have called the output file "rozemarijn.wav" or
"rozemarijn.ogg", but that wouldn't change anything. The audio
would still be in MP3 format.
The following are suggestions for how to see what URLs your computer is accessing. This can be useful, for example, if you can see a video in your browser and you want to download it directly. I haven't gotten to try these commands out yet. They were suggested in a discussion thread on LWN.net (Thanks!).
Hmm, I don't remember exactly what this does:
ffmpeg -i filename -ab 56 -ar 44100 -b 500 -s 320x240 filename.mpg
It might have something to do with Rockbox's instructions for shrinking videos.
Here's another. It's changes the size to 176x144, discards the audio
(-an), uses 15 frames per second and changes the video codec.
avconv -i inputfile.flv -s 176x144 -an -vcodec h263 -ac 1 -ar 8000 -r 15 -ab 32 -y outputfile.3gp
mplayer -fs -panscan 0.8 name-of-film.ogv
Here's what I did to get the necessary Debian packages working to allow me to install MediaWiki 1.17.0 from source. There's a MediaWiki package in Debian but it was out of date. Further down on this page there's my notes about the installation and setup of MediaWiki itself.
apache2 php5 php5-mysql mime-support - the dependencies of Debian's MediaWiki packageapache2-doc - not essentialmysql-serverlibapache2-mod-php5 - actually, I'm not sure this was necessaryhttp://127.0.0.1/ in my
web-browser and I see an "It works!" message. (Same if I
visit http://localhost/ )a2enmod userdir/etc/init.d/apache2 restartpublic_html directory, and I
put an index.html file in there with "Hi!".chmod 644 public_html/index.htmlhttp://127.0.0.1/~ciaran/ and
I see "Hi!"You don't have permission to access /test-wiki on this
server/home/ciaran/) was 700
(rwx------). I changed it to 701 (rwx-----x)
and then Apache could see my index.html and other files.
Ok, that's Apache working. PHP next.
apache2.conf to allow PHP code in user directories.
This caused various problems until I removed those lines./etc/apache2/mods-enabled/php5.conf and, following the
instructions there, comment out five lines. Here's how that part of the
file looked after I'd done the recommended edit:
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
# 2011-08-15: REMINDER: CIARAN COMMENTED OUT THE FOLLOWING FIVE LINES
# <IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_value engine Off
# </Directory>
# </IfModule>
/etc/init.d/apache2 restartpublic_html/test.php and I write a minimal
piece of PHP code: <?php phpinfo(); ?>http://127.0.0.1/~ciaran/test.php I see blue and grey tables
of info about my PHP installation - which is the correct output of
the phpinfo() function in my file..php files don't need to have executable permission.
Mine are 644 (rw-r--r--) and they work fine.That's PHP working.
MySQL didn't require any setup. I set a "root" password, but I think that was optional.
With Apache, MySQL, and PHP install (per above), here's what I then did to get MediaWiki 1.17.0.
~/public_html/
and renamed the resulting directory from mediawiki-1.17.0
to test-wiki.
http://127.0.0.1/~ciaran/test-wiki/ in my
web-browser and I get an set of screens for configuring MediaWiki.
umask command in my .profile. To fix the
permissions I ran these two commands:find test-wiki -type d -print0 | xargs -0 chmod 755find test-wiki -type f -print0 | xargs -0 chmod 644
Setting up database... done
Creating tables... done
Creating database user... done
Populating default interwiki table... done
Initializing statistics... done
Generating secret keys... done
Creating administrator user account... done
Creating main page with default content... done
LocalSettings.php which I
put in my wiki's dir (~/public_html/test-wiki/LocalSettings.php).http://127.0.0.1/~ciaran/test-wiki/ and my wiki's there, up
and running. I can edit pages etc.That was pretty easy. I'm surprised that MySQL required no attention at all.
While looking into caching and performance I found people suggesting the following:
memcached: The advantage of this system is that it works
even when a wiki is running on multiple servers. The disadvantage is that
it's much more complicated. I might test this, but I think it's unlikely to
be what I'm looking for.suhosin.get.max_value_length to 1024 or higher
in php.ini, and
set $wgResourceLoaderMaxQueryLength to the same value
in LocalSettings.php.I got error messages when reading MP3s with Mplayer. With a 2012 version, the error message was something like:
And when I downgraded to a 2010 version of mplayer, I got a different error:
Each repeated hundreds of times.
The solution seems to be (not tested yet) to tell mplayer to use another
backend. mplayer -ac help will show the available backends,
and you can use another with the command switch -afm ffmpeg (to
use the "ffmp3" codec/backend.
(Go: homepage of Ciarán O'Riordan)
(I made the Emacs and GNU buttons. Feel free to do with them whatever you like.)
© Copyright 2013 Ciarán O'Riordan. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. Distribution of modified versions of all or part of this article are permitted, provided that such works carry three things: (1) this copyright notice, (2) prominent notices stating the that it has been changed, and (3) information for how to obtain the original (such as a URL).