/dev/blog/ID10T

Advertisement

Compile newer Python version on Ubuntu

• Linux, Python, and Ubuntu • Comments

Most of my “second use” platforms, like Test VMs or laptops I rarely use, are running on Ubuntu LTS versions. This enables me using those devices for a long duration without investing too much maintenanc time to keeping them up to date. The downside however is slightly aged software. In this special case, I needed Python >= 2.7.9 for its improved TLS handling, but Ubuntu 14.04 (Trusty Tahr) only delivers 2.7.6. I’d rather not upgrade the systems Python implementation, as it could possibly break some system scripts. So I wanted to have another Python installation beside my systems Python. Here’s how to do it.

  # 1. Install dependencies

  sudo apt-get install build-essential checkinstall \

    libreadline-gplv2-dev libncursesw5-dev libssl-dev \

    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
  # 2. Get Python (you should probably check the MD5sum, but I ignore that step here)

  curl https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz | tar xzvf -
  # 3. ./configure as you like it

  cd Python-2.7.10 && ./configure --with-ensurepip=yes --enable-ipv6
  # 4. make an "install besides an install"

  sudo make altinstall
  # 5. If you compiled Python with pip, do an upgrade

  sudo /usr/local/bin/pip2.7 install --upgrade pip

This will place this new Python installation into the directory tree of /usr/local/.

Internal: Blog errors fixed

• blog • Comments

For the few readers who have subscribed to my blog via RSS: I’m deeply sorry if you got the last 10 posts of me delivered over and over again. The last days I was in the progress of fixing errors which were introduced when converting from Wordpress to Jekyll and resulted in over 9000!!! (Okay, only ~6000) 404 errors. It were mostly errors made by myself. Wrong substitutions, typos, wrong assumptions were only three of many. I now cleaned up everything I could find, so I really hope you won’t get annoyed anymore.

No errors!

You can’t imagine how satisfying this LinkChecker report feels to me. :-)

Linux: Select all files in a folder

• Linux • Comments

I wrote a very similar post nearly three years ago (in German) and still need this daily. As I’m currently writing a lot of Dockerfiles, I realised my post wasn’t completely accurate. Although I redacted it, it’s a good opportunity to port the original post to the english language.

Requirement:

Select all files in a directory, including hidden ones or files beginning with crude symbols. But exclude . and .. as those will most likely lead to an exit code > 0.

Lets assume we want to chown all files in the directory /var/www/html:

[email protected]:/var/www/html# ls -la
total 60
-rw-r--r--.  1 root     root         2 Nov 30 09:25 --test
-rw-r--r--.  1 root     root         2 Nov 30 09:25 -test
drwxr-xr-x.  5 www-data www-data  4096 Nov 30 09:25 .
drwxr-xr-x.  3 root     root      4096 Nov 20 08:35 ..
-rw-r--r--.  1 root     root         0 Nov 30 09:24 ..a
-rw-r--r--.  1 root     root         0 Nov 30 09:24 ..aa
-rw-r--r--.  1 root     root         0 Nov 30 09:24 ..aaa
-rw-r--r--.  1 root     root         0 Nov 30 09:24 .a
-rw-r--r--.  1 root     root         0 Nov 30 09:24 .aa
-rw-r--r--.  1 root     root         0 Nov 30 09:24 .aaa
-rw-rw-r--.  1 root     root      1509 Aug 23 13:57 .htaccess.dist
-rw-rw-r--.  1 root     root       306 Aug 23 13:57 README
-rw-rw-r--.  1 root     root        23 Aug 23 13:57 VERSION
drwxrwxr-x.  2 root     root      4096 Nov 30 09:23 conf
drwxrwxr-x. 12 root     root      4096 Aug 23 13:57 data
-rw-rw-r--.  1 root     root     19372 Aug 23 13:57 feed.php
drwxrwxr-x.  3 root     root      4096 Nov 30 09:22 lib

Notice how we got a lot of strange filenames here, including files beginning with dashes or double dots.

Ubuntu: Full Youtube HTML5 Player support for Firefox

• linux and firefox • Comments

Problem: Firefox on Ubuntu doesn’t support the whole spectrum of HTML5 features Youtube provides.

Youtube HTML5 unsupported Features

Solution:

Switching the following about:config Settings to true:

media.mediasource.webm.enabled
media.mediasource.enabled
media.fragmented-mp4.exposed
media.fragmented-mp4.ffmpeg.enabled
media.fragmented-mp4.gmp.enabled

Using netcat as port listener

• linux • Comments

Short but useful tip:

If you want to test if a port is open on Linux (e.g. all firewalls were opened) but you don’t have the listening application installed yet, you can use nc/netcat.

On the server side do:

# For TCP

nc -l -p $PORT_NUMBER
# For UDP

nc -l -u -p $PORT_NUMBER

On the client side you can now connect to the listening port:

# For TCP

nc host.tld $PORT_NUMBER
# For UDP

nc -u host.tld $PORT_NUMBER

This is basically a telnet chat, so you can send strings which should then be received on the other side. If you want even more good uses for netcat, I recommend this blog post.

Advertisement