ping: google.com: Temporary failure in name resolution [closed]

I’ve faced the exactly same problem but I’ve fixed it with another approache. Using Ubuntu 18.04, first disable systemd-resolved service. sudo systemctl disable systemd-resolved.service Stop the service sudo systemctl stop systemd-resolved.service Then, remove the link to /run/systemd/resolve/stub-resolv.conf in /etc/resolv.conf sudo rm /etc/resolv.conf Add a manually created resolv.conf in /etc/ sudo vim /etc/resolv.conf Add your prefered DNS server there nameserver 208.67.222.222 I’ve tested this … Read more

Adding new column to existing DataFrame in Python pandas

Edit 2017 As indicated in the comments and by @Alexander, currently the best method to add the values of a Series as a new column of a DataFrame could be using assign: Edit 2015Some reported getting the SettingWithCopyWarning with this code.However, the code still runs perfectly with the current pandas version 0.16.1. The SettingWithCopyWarning aims to inform of a possibly … Read more

What is meant by Resource Acquisition is Initialization (RAII)?

It’s a really terrible name for an incredibly powerful concept, and perhaps one of the number 1 things that C++ developers miss when they switch to other languages. There has been a bit of a movement to try to rename this concept as Scope-Bound Resource Management, though it doesn’t seem to have caught on just yet. … Read more

What does O(log n) mean exactly?

The most common attributes of logarithmic running-time function are that: the choice of the next element on which to perform some action is one of several possibilities, and only one will need to be chosen. or the elements on which the action is performed are digits of n This is why, for example, looking up … Read more

How can I parse a YAML file in Python

The easiest and purest method without relying on C headers is PyYaml (documentation), which can be installed via pip install pyyaml: And that’s it. A plain yaml.load() function also exists, but yaml.safe_load() should always be preferred unless you explicitly need the arbitrary object serialization/deserialization provided in order to avoid introducing the possibility for arbitrary code execution. Note the PyYaml project … Read more

How can I exclude one word with grep?

You can do it using -v (for –invert-match) option of grep as: grep -v “unwanted_word” file will filter the lines that have the unwanted_word and grep XXXXXXXX will list only lines with pattern XXXXXXXX. EDIT: From your comment it looks like you want to list all lines without the unwanted_word. In that case all you need is:

What is newline character — ‘\n’

From the sed man page: Normally, sed cyclically copies a line of input, not including its terminating newline character, into a pattern space, (unless there is something left after a “D” function), applies all of the commands with addresses that select that pattern space, copies the pattern space to the standard output, appending a newline, and deletes … Read more