[mongodb] invalid GPG signatures

February 8, 2018 Leave a comment

Problem
I have an Ubuntu 14.04 LTS box with MongoDB. When I tried to update the packages, I got a similar error:

W: GPG error: http://repo.mongodb.org trusty/mongodb-org/3.2 Release: The following signatures were invalid: BADSIG D68FA50FEA312927 MongoDB 3.2 Release Signing Key 
WARNING: The following packages cannot be authenticated!
mongodb-org-shell mongodb-org-server mongodb-org-mongos mongodb-org-tools mongodb-org E: There are problems and -y was used without --force-yes

Solution

sudo apt-key list | \
 grep "expired: " | \
 sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
 xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys

Full explanation of this is here. In a nutshell: update expired keys from Ubuntu key server.

Advertisements

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