Aug 292016
 

When you install a new Linux alongside another one, your computer will likely use the last installed OS’s GRUB instead of the one from the previous install.

In my case, I have installed Debian, and a few days later, a Linux Mint on the same disk. But the thing is I prefer the Debian’s GRUB because it is prettier, with a nice image background! Also, I want to keep Debian as my default choice on boot. I could have modified the boot order via Grub Customizer (I will let you Google that) but still! The Debian’s GRUB is better than the Ubuntu’s (Linux Mint’s) dark and ugly one. 😛

Step by step

To use the old install’s GRUB, use those commands from the old OS (Debian for me):

  • … with the X corresponding to your disk of installation. For example: sudo grub-install /dev/sda

  • Then reboot and enjoy!

I hope this helps! I have found those steps on the Ubuntu’s documentation: https://help.ubuntu.com/community/Grub2/Installing

Aug 282016
 

Surprised

The japanese IME on Debian, when installed properly, works pretty much similarly to the Windows 7 one… I was quite surprised by the quality of this software piece.

Step by step

  1. Install those packages from official repositories: ibus and ibus-mozc (along with their dependencies, of course).
  2. Launch the Region & Language settings app.
  3. In Input Sources, click on the + sign.
  4. Search for the Japanese (Mozc) input source and add it.
  5. You are ready to use the IME. 🙂 Quickly switch between input sources with Super (Windows key) + Space.

Okay, it’s possible it will not work on your side. I have done some other steps but I am not sure if they were useful or not (I started from a near fresh install). If the steps above didn’t work, you may have to open the Input Method app. Then click on Yes, Yes. Select ibus and click OK. Then OK again. Then restart your computer. From there, you should be able to add the Japanese (Mozc) input source in the Region & Language settings app.

Some day, I will try to redo those steps in a virtual machine to make sure the steps are working… Until then, 幸運を祈ります!

Additional Notes

  • Use the keyboard layout selector widget in the GNOME’s top bar to change the input mode from Direct to Hiragana.
  • In the Region & Language app, click on the Options button and select Allow different sources for each window if you find this behavior more practical (it’s my case!).
Aug 032016
 

I was doing an ingame video capture and I needed to have it in a GIF format. A few frames of the animation could be optimized as there were sometimes still images. So if I wanted to remove those unnecessary frames (while keeping the correct duration, of course), one can simply use ImageMagick.

How to

ImageMagick should be included by default in Debian and probably other distributions. So you just have to use the convert command. Here is an example:

It will remove duplicate frames and try to optimize frames by looking at similar areas of the pictures across the animation so they don’t appear twice.

Now, if you have specific needs, you better check the documentation here: http://www.imagemagick.org/Usage/anim_opt. There are some examples which will give you an idea of how to perform the best optimization.

Aug 032016
 

Didactic

I am writing a little tutorial here for creating a QRCode for a vCard file. As I don’t use it that much, it feels like I need a memo for it.

Preparation

We will use a vCard file named test.vcf which contains the following:

Result file

A vCard image QR encoded

A vCard QR encoded

Generating the image

Prerequisites

  • qrencode package with its dependencies.

Step by step

  1. In the Terminal, execute the following:

That’s all! A file named test.vcf.png will be created or overwritten if it already exists.

If you want to change or get rid of the margin, use the -m option with the size in pixels:

If you want to change the dots size, use the -s option with the size in pixels:

Please check the manual if you need more options such as output format (PNG, EPS, SVG, ASCII, etc.).

Additional Notes

The same thing with an UI

You can also use frontends to generate QR encoded files: qtqr package (available on Debian repository) seems interesting.

vCard syntax

  • If you want to add or remove your own fields, my advice would be to check the properties on the Wikipédia page: https://en.wikipedia.org/wiki/VCard#Properties
  • Make sure to use the right properties for the right vCard version. I am using 2.1 in my example.

Things to consider to prevent reading failures

  • Make sure the color contrast between the dots and the background is sufficient.
  • Dots should remain dark and the background should remain clear.
  • Make sure the dots are large enough if you want devices with fixed focus (such as my Moto E 1st Gen) to read the image. For instance, the example image was generated with a 4px dot size; 3px dot size was not readable by my Moto E on a 22″ 1920×1080 screen.
  • If you resize your image in a graphics software, it is best to use nearest neighbor interpolation algorithm to preserve sharp dots.
  • If your dot size is 1px, don’t shrink your image as it will lose information. (pretty obvious)
  • Make sure the QR code users will physically have access to the space right in front of the image / print. So don’t put a barrier in front of the image…
Jun 262016
 

Preparation

We will use this file named texfile.tex as the .tex to convert:

Result file

PNG demonstration

PNG demonstration

Generating PNG images

Packages you need:

  • texlive (or any other TeX program, I guess)
  • dvipng

Step by step

  1. In the Terminal, go to the directory containing the .tex file.
  2. Execute this:
    • Output:
  3. Convert to PNG at 150dpi (to get a larger image than default):
    • Output:
  4. Remove the border white spaces of the page and add some borders using imagemagick:
  5. Your file is ready as texfile_trimmed.png.

Script

I have made a little script to automatize the conversion, with auto-remove of intermediary files:

Usage
  1. Save the above script as tex2png, anywhere you want, usually near your .tex files for convenience.
  2. Make it executable: $ chmod +x tex2png.
  3. Syntax: tex2png filename [-keeptempfiles].
    • Example: $ tex2png texfile.tex.
    • Alternatively, you can omit the .tex extension: $ tex2png texfile but I would not recommend it.
    • If you want to keep the intermediary files (dvi, log, etc.), add the -keeptempfiles argument at the end: $ tex2png texfile.tex -keeptempfiles.
  4. The final image is named texfile_trimmed.png

Generating SVG images

Packages you need:

  • texlive

Step by step

  1. In the Terminal, go to the directory containing the .tex file.
  2. Execute this:
    • Output:
  3. Convert to a SVG image with a 1.5 scale factor:
  4. Your file is ready as texfile.svg.

Remarks

There is no padding in the SVG method. I have not found yet a method to add a little padding around the figure.

Also, the --no-fonts is necessary to prevent rendering issues about SVG fonts, especially with Firefox and the default SVG viewer of Debian. So the generated formula will not be selectable as a text, but at least, it will render correctly on every device with SVG support.

Background

I needed to include some nice looking formulas on my new game design wiki. I am using MediaWiki but the math add-on was not working on my server (web hosting service, not mine). So I decided to create myself the images offline and upload them as regular image files, so that I don’t need to think too much about trying to set the add-on without having all the privileges I could have on a personal server.

Jun 192016
 

Tired

Time spent to get the info: one day. Length of the fix: a few lines. Haha, this is so ridiculous it makes me smile a little.

Okay, so you are:

  1. on fresh Debian Jessie (GNOME 3),
  2. on a laptop,
  3. with an integrated graphics unit,
  4. and it is an Intel CPU. In my case, I have a Core i3 Sandy Bridge CPU with HD Graphics 3000.

The backlight function keys:

  1. are working so you have an on-screen display feedback,
  2. are not changing the effective brightness of your screen,
  3. are changing the values of this file: /sys/class/backlight/acpi_video0/brightness (close and reopen in gedit to see the value changing or check by command line).

You have this folder: /sys/class/backlight/intel_backlight.

Yay! You may have a solution!

  1. Create a file:
  2. Add this in the file:
  3. Save file.
  4. Close gedit.
  5. Restart the computer.
  6. It should work now!

If this fix does not work on your laptop, I am sorry to hear that but I cannot help you further. Don’t ask the noob. I have just followed guidance on linux threads such as here: link to Ubuntu’s launchpad website. Good luck!