Archive
Remux .m4v (and probably others) to .mkv
Easy.
ffmpeg|avconv -i input.m4v -vcodec copy -acodec copy out.mkv
So easy this post is actually done here.
Friends don’t let friends use id3v2…
… use eyed3 for your command line tagging/display needs instead. Seriously, if you write id3v2.4 tags (which I guess most taggers do nowadays), id3v2 unfortunately doesn’t see/support them.
See everything and the kitchen sink about your harddrive
Ever wondered what specifications your harddisk/SSD actually has? hdparm is your best friend here. I wondered whether my Corsair SSD actually had TRIM supported/enabled, and this is what sudo hdparm -I /dev/sda (of course, replace /dev/sda with w/e your desired device node is) got me:
Read more…
Ubuntu / PERL locale errors/warnings
You get this?
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = “en_US.UTF-8″, LC_ALL = “en_US.UTF-8″, LANG = “en_US.UTF-8″ are supported and installed on your system.
Use this!
export LANGUAGE=en_US.UTF-8 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 locale-gen en_US.UTF-8 dpkg-reconfigure locales
Worked for me. Of course, replace en_US with w/e your primary language is.
Remove all non-printable ASCII Characters from filename
Sometimes I get some crappy zipped/rared/whatever packages that contain filenames that are not UTF-8 encoded, mostly from old package programs used on the Windows platform. What happens is that those packages will unpack just fine, but more often than not you end up with filenames that contain non-printable characters. PITA if there’s a lot of them. tr to the rescue!
ls -1 | while read file; do N=$(echo $file | tr -cd '\11\12\40-\176'); mv "$file" "$N"; done
What this does is basically:
- get every filename in the current directory and toss it to tr
- the -c and -d options used like this command tr to only output characters that we actually specify
- the quoted argument tells tr to only retain the octal characters 11, 12 and 40 to 176. Octal 11 is Tab, 12 is linefeed (technically, this should be omitted from a filename, but I also use this to filter textfiles, so it comes in handy and is of no real harm here). 40 to 176 are the standard keyboard characters from space to ~, which we actually like in our filenames.
- finally, we move the garbled filename to the new, cleaned up version.
/usr/NX/bin/nxserver –keygen … Please, I want the last two hours of my life back!
As good as Nomachine’s NX is … the documentation is seriously confusing and all over the place with some documents more complete than others.
I tried to check out their new 4.x preview just yet (oh, and no, it’s definitely not ready for production), and as I always do, generate my own keys to go with it. But after the usual /usr/NX/bin/nxserver –keygen, a restart failed with
NX> 500 ERROR: Cannot start service: nxserver NX> 500 Authentication as user nx using the NX SSH key-pair failed. NX> 500 This may be due to the configuration of your SSH server. Please NX> 500 ensure that the location and file name of the SSH authorized NX> 500 keys is the same in both the SSHD and NX server configuration NX> 500 files and that the nx user is listed among the accepted users NX> 500 in the SSHD configuration file. NX> 999 Bye.
Got seriously frustrated, because all seemed well according to documentation. Well, it seems like there is one important step missing – renaming or copying
/usr/NX/share/keys/default.id_dsa.key
to
/usr/NX/share/keys/server.id_dsa.key
If you don’t do that, nxserver will happily continue to use its prior key (which makes sense I guess, you aren’t going into production with new keys the second you generate them) while the nx user will already have the new keys in place.
So basically the procedure is:
# /etc/init.d/nxserver stop # /usr/NX/bin/nxserver --keygen # chown nx:root /usr/NX/home/nx/.ssh/authorized_keys2 # chmod 0644 /usr/NX/home/nx/.ssh/authorized_keys2 # chown nx:root /usr/NX/home/nx/.ssh/default.id_dsa.pub # chmod 0644 /usr/NX/home/nx/.ssh/default.id_dsa.pub # cp /usr/NX/share/keys/default.id_dsa.key /usr/NX/share/keys/server.id_dsa.key # /etc/init.d/nxserver start
Of course, your client(s) will also need to import the new server key.
NoMachine NX, Ubuntu and the XSession
If you get the dreaded
'Cannot run /etc/X11/xdm/Xsession ...'
when requesting a new session on an Ubuntu server, this – at least for me – fixed it:
sudo mkdir /etc/X11/xdm && sudo ln -s /etc/X11/Xsession /etc/X11/xdm/Xsession
Use ffmpeg to merge multiple avi files
cat avi1.avi avi2.avi avix.avi > avi_all.avi ffmpeg -i avi_all.avi -acodec copy -vcodec copy avi_all_reindexed.avi
Split a video file on the command line
Since it’s so insanely useful and installing/using the common graphical video editors is pretty much a pita:
ffmpeg -ss 00:15:00.0 -t 00:10:0.0 -i <source>.foo -vcodec copy -acodec copy <destination>.foo
Above command clips everything to the 15 minute mark, puts the following 10 minutes into the destination file and then clips everything after that.
If you leave out the -t parameter, everything from the -ss mark to the end gets copied to the destination file. Useful and fast.
Merge subtitles into a Matroska container on the command line
Actually pretty darn easy – surely faster than using the GUI.
mkvmerge -o <output>.mkv --default-track 0 --language 0:<language> <subtitles>.srt <input>
You can list the language codes by invoking mkvmerge with the --list-languages (e.g. eng for English, ger for German) parameter. The --default-track parameter just sets the newly muxed subtitles as default for the player to use. If you are muxing multiple subtitles, you of course have to change the language code preceding number.
Life Changing Chrome Extension Of The Month: Hover Zoom
Seriously, it’s that good. What Hover Zoom by Romain Vallet does? It ‘simply’ loads the images behind little thumbnails and displays them in an overlay frame.
Sounds simple? I’m sure it isn’t, even more so if you look at the supported sites:
• Amazon • Last.fm • 4chan • Baidu (百度) • MySpace • Reddit • deviantART • Picasa Web Albums • Imgur • eBay • Twitter • Panoramio • Facebook • Wikipedia • Fotolog • Flickr • Windows Live Photos • VKontakte (ВКонтакте) • Google Images • Yahoo • YouTube • Google+ • WordPress
Apart from these officially supported sites, I found Hover Zoom working well for quite a lot of other websites on which it ‘just works’.
The author has done an amazing jobs keeping the extension really simple and unobtrusive, with options for whitelisting certain sites, adjustable delay and fading effects and zoom on keyhold. It even displays captions below the zoomed image if it’s able to catch one. This is the kind of extension that’s hard to describe, but once you’ve installed it you are going to miss it on any browser that doesn’t have it.
![]() |
![]() |
Hover Zoom is available from the Chrome Web Store.
Ever wondered what font’s being used on a webpage?
I certainly have. And it bugged me to no ends having to look for the CSS and then maybe, just maybe find what font family’s being used. Sure, FireBug and the integrated Chrome Developer Tools eased that process somewhat, but still… well, no more. I wish I’d known earlier that the fabulous WhatFont existed. It’s a Bookmarklet/Chrome Extension/Safari Extension that basically sits somewhere until you click it. You can then hover over any text and it tells you what font’s being used to display it. If you click you get additional information about the font service used, size etc. etc. Invaluable!
Screenshot shows the Chrome Extension.
Switching your default Sans/Sans Serif/Monospace Fonts 2.5
And another update on my quest to a great .fonts.conf configuration, update from my updated-original post.
All stuff still applies, but newer freetype/fontconfig builds now support the Byte Code Interpreter, which provides a truly great font experience in combination with good fonts (*cough* hint: ChromeOS Fonts *cough*). My updated .fonts.conf is as follows (enabled BCI, enabled Sub-Pixel Rendering, enabled LCDFilter):
<?xml version="1.0"?>
<!--?xml version="1.0"?>-->
<!--DOCTYPE fontconfig SYSTEM "fonts.dtd">-->
<!-- ~/.fonts.conf for per-user font configuration -->
<fontconfig>
<!-- Alias commonly used default names -->
<!-- serif, sans-serif, sans and monospace -->
<!-- to the ChromeOS fonts -->
<alias>
<family>serif</family>
<prefer>
<family>Tinos</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Arimo</family>
</prefer>
</alias>
<alias>
<family>sans</family>
<prefer>
<family>Arimo</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Cousine</family>
</prefer>
</alias>
<!-- Replace Arial, Times New Roman, Verdana and Courier New -->
<!-- with their counterparts. Strong binding used to override -->
<!-- distribution defaults -->
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Arial</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Arimo</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Times New Roman</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Tinos</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Verdana</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Arimo</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Courier New</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Cousine</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Courier</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Cousine</string>
</edit>
</match>
<match target="font">
<!-- BCI Hinting -->
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintfull</const>
</edit>
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
<edit mode="assign" name="lcdfilter">
<const>lcddefault</const>
</edit>
<!-- Auto Hinting, BCI works better for me
Your mileage may vary
-->
<!--
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintmedium</const>
</edit>
-->
<!-- Turn off Autohinting for bold fonts -->
<!--
<match>
<test name="weight" compare="more">
<const>medium</const>
</test>
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
</match>
-->
</match>
</fontconfig>
I am now truly satisfied on my Arch Linux box – while Ubuntu might have the best font experience out of the box, an equal experience on any decent modern distribution is just a configuration file and some great fonts away.
If I had one wish this year…
… it would be Spotify officially available in Germany. The software (hello wireless iPhone syncing!) and the service is so good, it’s hard to live without once you experienced it. Maybe Apple will introduce something reasonably priced… it will still come with the monster that is called iTunes. And it sucks.
SELinux, vsftpd and you
Setting up some new RHEL 6 servers I came across the odd need of enabling ftp access to /tftpboot on those machines came up. SELinux didn’t really like that idea and denied access, which by default is a very good idea. Diabling SELinux is of course no option at all.
It is pretty well known and documented that setsebool -P ftp_home_dir=1 allows access to system users’ home directories. But what about other directories outside of /home? audit2allow to the rescue!
# audit2allow -a
============== ftpd_t ==============
#!!!! This avc can be allowed using the boolean 'allow_ftpd_full_access'
allow ftpd_t tftpdir_rw_t:dir { write remove_name add_name };
#!!!! This avc can be allowed using the boolean 'allow_ftpd_full_access'
allow ftpd_t tftpdir_rw_t:file { write create unlink append };
Basically this little known, but invaluable helper goes through your audit.log and tells you what can be done to avoid those denies; in this case
setsebool -P allow_ftpd_full_access=1
therefore allows vsftpd to write to any system directory the currently logged in user can get access to.



