Getting started on Twitter

January 2, 2018 Leave a comment

You have a site and you want to create a Twitter site for it too where you want to send posts, probably in an automatic way.

If you have a gmail account, you can use it to create several Twitter accounts. The trick is to make the e-mail addresses different with a dot. Example: and . If you send an e-mail to these addresses, they’ll arrive in the same mailbox, though Twitter treats them as two different addresses.

Then, follow the steps at to register your app.

Sample Python code
Here is a simple example to post a tweet:

#!/usr/bin/env python3

import config as cfg
import tweepy

def get_api(cfg):
    d = cfg.twitter_keys
    auth = tweepy.OAuthHandler(d['consumer_key'], d['consumer_secret'])
    auth.set_access_token(d['access_token'], d['access_token_secret'])
    return tweepy.API(auth)

def main():
    api = get_api(cfg)
    tweet = "just a test"
    status = api.update_status(status=tweet)    # update_status -> send a tweet

if __name__ == "__main__":
Categories: python, web Tags: , , , ,

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

January 2, 2018 Leave a comment

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?

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": [

Then map a key in keybindings.json:

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

[mongo] Upgrade to version 3.6

January 1, 2018 1 comment

Under Manjaro, my MongoDB 3.4 was upgraded to version 3.6 and it stopped working. Great!

In the log file I found this error: “IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see for more details.

Visiting the link in the error message, it was suggested to execute a DB command in the mongo shell. But the Mongo server was not willing to start, thus I couldn’t connect to it with the Mongo shell!

So I downgraded to version 3.4 just to be able to start the Mongo shell and execute the command “db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )“. Now I upgraded MongoDB to version 3.6 and it started happily.

Categories: linux, manjaro, mongodb Tags: ,

connect your laptop to your TV

December 30, 2017 Leave a comment

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.

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.

[windows] Xpadder: play any game with your controller

December 29, 2017 Leave a comment

Xpadder allows you to map keyboard keys and mouse button actions to your game controller buttons. Xpadder also allows you to map the mouse pointer to your game controller sticks. Xpadder can also handle combinations, sequences, toggles, triggers, shift sets, multiple controllers and more.” (source)

So, if you have a game that doesn’t support controllers, then with the help of Xpadder you can still use your favorite controller.

These two videos will give a good introduction to the program:

Short press: A; long press: B (from the advanced tutorial)


What are set selectors? I found a good explanation under this video by Hugo Freitas. I copy his answer here:

For those who couldn’t understand, i’ll explain: Xpadder does not directly support the scheme of pressing two buttons for one keyboard stroke (Under the circumstances of using One Set Only), So what happens in order to make this possible is a sort of trick: Xpadder divides it’s variety of commands on different sets (those sets are clearly noticeable on the bottom side of the software window). If a person wants to perform a command requiring two buttons, What such person needs to understand, is that the first button usually works as an “enabler”, so the Second Button can have it’s behavior changed to perform the command.

In order to make things more comprehensible, i’ll give an example: In Tony Hawk’s American Wasteland, there’s a trick called “Caveman”, on the ps2 version, in order to perform such command, the player needs to hold “L1” then press “R1” (Note that L1 being held acts like an “enabler” , so the R1 can have it’s behavior changed to perform the trick). For instance However, in the PC version of the game, all the player needs to do is press “E” on the Keyboard.

Given this Situation, In order to reproduce the “L1 + R1” combination on Xpadder, what you need to do is select the “L1” button, click on it, go to the “Advanced” > “Set Selector” and choose: “Selects Set 2 while HELD”, as a consequence, when holding “L1” button, it will switch to/enable the Second Set which will have empty assignments, and while holding “L1” down, select “R1” button, click on it and assign the “E” button to it.

And that’s it, Regardless the controller you’re using, if it’s compatible with Xpadder, I believe the Set Selector will work on all of them.” (quote from Hugo Freitas)

I collect here the profiles that I made / customized. The profiles can be found here.

  • Need for Speed Hot Pursuit 2
Categories: games, windows Tags: , ,

Advent of Code 2017

December 25, 2017 Leave a comment

This year I jumped into Advent of Code again. It was a great fun and I was waiting the new exercises every morning. Today I finished it:

This year I solved all the exercises in Kotlin. I will publish my solutions on GitHub soon. Update: here is the repo.

Here is a link to the Twitter page of Eric Wastl, to whom we can thank the Advent of Code. Thanks, Eric and keep up the good work!


Categories: kotlin, programming Tags: , ,

vuze goes to queued status

December 19, 2017 Leave a comment

The status of downloaded torrents in Vuze switch to “queued” after a while. How to keep them in “seeding” status?

I found the solution here. It works for me.

Categories: Uncategorized Tags: , , ,