Archive

Archive for the ‘Uncategorized’ Category

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”.

[Nim] cross-compile under Linux to Windows

October 23, 2018 1 comment

Problem
You are under Linux, and you can produce an executable binary with the Nim compiler. However, you would like to produce a Windows EXE too. We want to stay under Linux and we want to produce the EXE on Linux. How to do that?

Solution
On Manjaro, I had to install this package:

$ yaourt -S mingw-w64-gcc-bin

It’s a cross-compiler that we’ll use for producing the EXE.

Let’s take a simple Nim source (hello.nim):

echo "hello windows"

Now cross-compile it:

$ nim --os:windows --cpu:amd64 --gcc.exe:x86_64-w64-mingw32-gcc --gcc.linkerexe:x86_64-w64-mingw32-gcc -d:release c hello.nim

And you get hello.exe .

$ file hello.exe
hello.exe: PE32+ executable (console) x86-64, for MS Windows

If you copy it on a Windows system, you can run it there without any problem. Or, you can also run it under Linux with wine :)

$ wine hello.exe
hello windows

Credits
I found this idea in the following blog post: Writing a 2D Platform Game in Nim with SDL2.

Update (20181028)
I found info about it in the official docs too: https://nim-lang.github.io/Nim/nimc.html#cross-compilation-for-windows.

moved from KeePassX to KeePassXC

October 13, 2018 Leave a comment

KeePassX served me very well in the last few years. It’s a password manager that keeps your usernames / passwords in an encrypted file and you only need to memorize just one master password.

KeePassXC is the community edition of KeePassX. From its FAQ: “KeePassX is an amazing password manager, but hasn’t seen much active development for quite a while. Many good pull requests were never merged and the original project is missing some features which users can expect from a modern password manager. Hence, we decided to fork KeePassX to continue its development and provide you with everything you love about KeePassX plus many new features and bugfixes.

I tried it and it could open my .kdbx database file without any problem. It has some nice changes compared to KeePassX so I think I’ll use this newer and fresher version. Just like KeePassX, it runs under Linux and Windows too.

Xbox 360 controller not detected

March 16, 2018 Leave a comment

Problem
I have a wired Xbox 360 controller that stopped working. Windows 7 doesn’t recognise it and it appears as an “unknown device”.

Solution
I tried everything: uninstall and reinstall the driver; reinstall the USB drivers that I got on a DVD for the motherboard; plug it in another USB slot. Nothing. After 1.5 hours, I found the solution: the cord has an inline release and it was not entirely connected… Damn. But the good news is that it works again :)

Lesson learned: if you have a problem with the controller, first check the inline release.

inline_release

Software Carpentry

January 3, 2018 Leave a comment

Software Carpentry is a community of volunteer instructors who teach short workshops and develop lessons which empower researchers of all disciplines to learn about and improve the ways in which they create software and collaborate.” (source)

I found them today: https://github.com/swcarpentry/swcarpentry . Looks good!

[VS Code] When commenting a line, move the cursor to the next line

January 2, 2018 Leave a comment

Problem
In IntelliJ IDEA, when you comment a line, the cursor is moved automatically to the next line. This way it’s very easy to comment several lines. In VS Code the cursor stays on the same line. How to copy the behavior of IntelliJ?

Solution
I asked this question on reddit, and /u/AlGonzalez kindly gave me the solution:

Use the geddski.macros extension to bind the two commands to a key combo:

Add the following macro to settings.json:

  "macros": {
    "commentLine": [
      "editor.action.commentLine",
      "cursorDown"
    ]
  }

Then map a key in keybindings.json:

  {
    "key": "ctrl+numpad_divide",
    "command": "macros.commentLine",
    "when": "editorTextFocus && !editorReadonly"
  }
Categories: Uncategorized Tags: , ,

connect your laptop to your TV

December 30, 2017 Leave a comment

Problem
You want to connect your laptop to your TV. For instance you have Netflix / HBO GO / etc. subscription and you want to watch movies on a bigger screen.

Story time
We have an old LG HD-ready television (32LG3000) whose resolution is 1366×768. I had an old (and small) laptop connected to the TV via a VGA cable that worked well with movies (avi, mp4, etc.). This laptop had Manjaro on it and its resolution was 1024×768. When it was connected to the TV, the screen was cloned and the TV also had the same resolution. The image quality was very good. However, this laptop was weak for videos running in the browser, so for instance I couldn’t watch Youtube videos in full screen.

A few days ago I decided to try HBO GO. It’s similar to Netflix. It’s not expensive (7.66 USD/month), the first month is free, and you can cancel it any time. It was clear that my old laptop won’t be enough for this.

I tried another laptop, a Toshiba C55 that has a VGA and an HDMI output too. Strangely, the VGA output was not recognized by my TV, so I couldn’t use it. And when I tried HDMI, the image quality was shit. The colors were terrible and the image was blurred. The text on the screen was ugly and the whole thing looked pixelated. I tried every resolution, but it was the same shit :( I even changed the HDMI cable to a gold-plated one. Nothing. With a software I could adjust the colors but I wasn’t satisfied with the colors at all.

Solution
I don’t know the exact reason of the problem. Maybe our TV is old, maybe a full-HD TV would be better, who knows… It was clear that there is something wrong with the HDMI connection.

So, let’s get back to VGA. I had yet another laptop, a Dell Vostro 2510 (also old). It worked well for me and it only had a VGA output. I installed Windows 7 on it, connected to the TV, but the TV only showed a black screen. And when I changed the resolution down to 1024×768, the screen appeared on the TV! Yes! And the quality was good! Later I figured out that the resolution 1280×720 was even better for this TV. This laptop is sufficient for videos running in a browser. It took me 3 days to find the best solution…

I also made some experiments. With VGA, I tried different resolutions, but they looked ugly. The result was similar to the HDMI. However, 1024×768 and 1280×720 were good. Then I tried HDMI again with these two resolutions and they were ugly again. I don’t get it but fine…

TL;DR: Via VGA I got better quality on the TV. On the laptop I put Windows 7. The resolution 1280×720 worked well. HDMI produced shit quality but I couldn’t figure out why. I’ll stay with VGA.