[manjaro] convert refuses to produce PDFs

January 10, 2019 Leave a comment

Problem
Under Manjaro, I wanted to create a PDF from some JPG files. However, convert dropped an error:

$ convert *.jpg out.pdf
convert: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408.

Solution
Edit the file /etc/ImageMagick-7/policy.xml and find the following line:

<policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,PDF,XPS}" />

Put it between comments (<!-- and -->) and everything is good again.

I found this solution here.

Advertisements
Categories: bash, linux Tags: , , ,

Advent of Code 2018 is over

December 25, 2018 Leave a comment

Similarly to last year, I participated in Advent of Code again. Last year I could finish it in time, but this year I missed some days. As today was the last day of the challenge, here is my result:

Screenshot_2018-12-25_23-10-46

This year the exercises were harder than last year. My solutions are on GitHub: https://github.com/jabbalaci/AdventOfCode2018 . This year I used the Nim programming language.

Categories: programming Tags: , , ,

cannot write to TrueCrypt volume

December 20, 2018 Leave a comment

Problem
With TrueCrypt 7.1a I created a new encrypted volume. After mounting it, I couldn’t write on it. “Permission denied”.

Solution
I had another encrypted volume that I could investigate. There, in the root folder, I saw the following:

$ ls -al | head                     
total 340
drwxr-xr-x  47 jabba optwriter   4096 Dec 20 17:08 .
drwxr-xr-x   5 jabba root        4096 Dec 20 17:03 ..
...

Here, “jabba” is my username. On the newly created volume the owner of “.” in the root folder was the root. Thus, the solution was the following:

# cd to the root folder of the new volume. Then:
$ sudo chown jabba:optwriter .

After this I had write permission on the new volume. Of course, replace “jabba” with your own username.

How to loop a YouTube video?

December 17, 2018 Leave a comment

Problem
You have a favorite song and you want to listen to it in a loop.

Solution
Right click on the video and select “Loop”.

You can open a markdown (.md) file in Okular

November 29, 2018 Leave a comment

Today I found out by accident that you can open a markdown file (.md) with okular. okular was just a PDF viewer for me. The .md file is nicely rendered and you can convert it to PDF or you can print it. Awesome!

Categories: linux Tags: , , , ,

[shell] How to tell your distro version?

November 28, 2018 Leave a comment

Problem
I use two different Linux distros, Ubuntu and Manjaro. Both of them are great. My shell resource files (previously .bashrc, now .zshrc) are shared via Dropbox. However, sometimes I would like to differentiate my Ubuntu and Manjaro settings, within the same resource file. How to do that?

Solution
Here is what I use:

# DESKTOP_SESSION is "ubuntu" (for Ubuntu) or "xfce" (for Manjaro)
if [[ "$DESKTOP_SESSION" == "ubuntu" ]]; then
  alias files='dpkg-query -L'
else
  alias files='pacman -Ql'
fi 

Older solution
Before finding the environment variable DESKTOP_SESSION, I used this:

# return "ubuntu", "manjaro" (without quotes)
get_distro_name() {
  cat /etc/os-release | grep "^ID=" | cut -d= -f2
}

# usage:
# if [[ $(get_distro_name) == "ubuntu" ]]; then
#   alias files='dpkg-query -L'    # ubuntu
# else
#   alias files='pacman -Ql'       # manjaro
# fi
Categories: shell Tags: , , , , ,

Steam client on Ubuntu 18.04

November 26, 2018 Leave a comment

Problem
Steam stopped working. At the end of an update process it complained that “steamui.so” was missing.

Solution
I found the solution here. In short:

First, delete steam:

sudo apt remove steam

Execute this:

sudo dpkg --add-architecture i386

Restart the machine. Then, install these packages:

sudo apt-get install wget gdebi libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libc6:i386

Download the steam package:

wget http://media.steampowered.com/client/installer/steam.deb

And install it:

sudo gdebi steam.deb

After this, steam started normally for me.

Hero of the Kingdom 2 patch
The game “Hero of the Kingdom 2” didn’t want to start. I got the error “access violation”. I found the remedy here.

It seems this problem is related to the Intel driver. I have an integrated Intel video card.

The solution in short: download the driver http://de.archive.ubuntu.com/ubuntu/pool/main/m/mesa/libgl1-mesa-dri_11.2.0-1ubuntu2_i386.deb , extract it, and replace the file /usr/lib/i386-linux-gnu/dri/i965_dri.so with the one from the archive. Of course, don’t forget to make a backup of the original file.