Archive

Archive for January, 2018

[manjaro] installation fails, unknown public key

January 17, 2018 Leave a comment

Problem
I couldn’t update a package due to the following error:

==> Validating source files with sha256sums...
    gcc-7.2.1-20171224.tar.xz ... Passed
    gcc-7.2.1-20171224.tar.xz.sig ... Skipped
    isl-0.18.tar.bz2 ... Passed
==> Verifying source file signatures with gpg...
    gcc-7.2.1-20171224.tar.xz ... FAILED (unknown public key BBE43771487328A9)
==> ERROR: One or more PGP signatures could not be verified!
==> ERROR: Makepkg was unable to build mingw-w64-gcc.
==> Restart building mingw-w64-gcc ? [y/N]
==> --------------------------------------
==> ==> ERROR: unable to update

Solution
I asked this on reddit and /u/SuperGrip kindly provided the solution:

This is a common issue when an apps key is not included in the ArchLinux Keyring, to solve this issue you can add the key manually by running the following command: gpg --recv BBE43771487328A9

For further information check the package comments on the AUR site. https://aur.archlinux.org/packages/mingw-w64-gcc/

Categories: manjaro Tags: , , , ,

DigitalOcean has new droplet plans

January 17, 2018 Leave a comment

DigitalOcean has some new droplet plans (more info here). The cheapest droplet was 5 USD, and you got 512 MB RAM and 20 GB SSD for this price. Now, for the same price you get 1 GB RAM and 25 GB SSD.

If you have a standard droplet, you can upgrade it for free. I did it today and it was just one click :) Of course, I made a snapshot first, but the upgrade went smoothly, so after some testing I removed the snapshot.

If you want to try DigitalOcean, here is my referral link: https://m.do.co/c/01da80980c60. If you sign up through this link, you also support me :)

Alternatives

Categories: linux Tags: ,

Books for Professionals

January 5, 2018 Leave a comment

See http://books.goalkicker.com/. Simply awesome! All books are free. The Python book is 700+ pages for instance.

Categories: book Tags: ,

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!

Getting started on Twitter

January 2, 2018 Leave a comment

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

Solution
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: myself@gmail.com and my.self@gmail.com . 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 https://python-twitter.readthedocs.io/en/latest/getting_started.html 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__":
    main()
Categories: python, web Tags: , , , ,

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

[mongo] Upgrade to version 3.6, 4.0, 4.2

January 1, 2018 1 comment

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

Solution
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 http://dochub.mongodb.org/core/3.6-upgrade-fcv 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.

Update (20190911)
Today I wanted to update MongoDB 3.6 to MongoDB 4.2 under Manjaro. The package manager contained a binary package that I could install easily but when I started it, the shell was version 4.2 but the server was still version 3.6! A few hours later I figured out that the problem was caused by the old server (v3.6) that was still running when I updated MongoDB. So the winning strategy was the following:

  • Remove 4.2 and put back 3.6. Start the mongo shell to see that everything works.
  • Stop the mongo server: “systemctl stop mongodb“.
  • Update to version 4.0 (using a binary package), start the server (“systemctl start mongodb“) and launch the mongo shell to verify that everything is OK.
  • In the mongo shell issue the command “db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )“.
  • Now we can move on to version 4.2. Stop the mongo server: “systemctl stop mongodb“.
  • Update to version 4.2 (using a binary package), start the server and launch the mongo shell to verify that everything is OK.
  • In the mongo shell issue the command “db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )“.

When you start / stop the server with systemctl, you’ll have to wait a few seconds to see its effect. You can verify the status of the server with “systemctl status mongodb“. It’s highly recommended that you install a binary package. Installing from source takes several hours even on a decent machine.

List of installed mongo packages: “pacman -Q | grep mongo“. When you want to upgrade, it’ll show you what packages to remove.

Categories: linux, manjaro, mongodb Tags: , ,