A way to determine a process’s “real” memory usage, i.e. private dirty RSS?

On OSX the Activity Monitor gives you actually a very good guess. Private memory is for sure memory that is only used by your application. E.g. stack memory and all memory dynamically reserved using malloc() and comparable functions/methods (alloc method for Objective-C) is private memory. If you fork, private memory will be shared with you … Read more

Why exit code 141 with grep -q?

This is because grep -q exits immediately with a zero status as soon as a match is found. The zfs command is still writing to the pipe, but there is no reader (because grep has exited), so it is sent a SIGPIPE signal from the kernel and it exits with a status of 141. Another … Read more

Insert newline (\n) using sed

The sed on BSD does not support the \n representation of a new line (turning it into a literal n): $ echo “123.” | sed -E ‘s/([[:digit:]]*)\./\1\n next line/’ 123n next line GNU sed does support the \n representation: $ echo “123.” | gsed -E ‘s/([[:digit:]]*)\./\1\nnext line/’ 123 next line Alternatives are: Use a single … Read more

InetAddress.getLocalHost() throws UnknownHostException

In good tradition, I can answer my own question once again: It seems that InetAddress.getLocalHost() ignores the /etc/resolv.conf, but only looks at the /etc/hosts file (where I hadn’t specified anything besides localhost). Adding the IP and hostname to this file solves the problem and the exception is gone. Another answer is almost correct and I … Read more

How to install packages offline?

On the system that has access to internet The pip download command lets you download packages without installing them: pip download -r requirements.txt (In previous versions of pip, this was spelled pip install –download -r requirements.txt.) On the system that has no access to internet Then you can use pip install –no-index –find-links /path/to/download/dir/ -r … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)