How to convert an object to json in Node.js?
How to convert general JavaScript objects to json in Node.js?
Assume jo
is a JavaScript object, you can convert it to a json string by:
JSON.stringify(jo)
How to convert general JavaScript objects to json in Node.js?
Assume jo
is a JavaScript object, you can convert it to a json string by:
JSON.stringify(jo)
If I quite a docker instanced (invoking /bin/bash) by Ctrl+d, the docker container is closed. How to detach a docker container to be a running daemon without closing it? Docker has a detach sequence, which, by default, is Ctrl-p + Ctrl-q. If the docker detach sequence is overridden by the –detach-keys=”<sequence>” flag, you need to…
Is is possible to cut in Linux using a string as the delimiter? cut –delimiter=”delim” -f 1,3 cut reports: cut: the delimiter must be a single character The most closest solution that I find is using awk/gawk: awk -F ‘delim’ ‘{print $1; print $3}’ From the manual: -F fs –field-separator fs Use fs for the…
Junk Emails, or Email spams, are annoying and they cost time to deal with. While they are something we need to cope with, we can use tools to help us. Thunderbird has an adaptive junk filter that can learn from user’s actions to identify junk messages. I find that Thunderbird default settings are not fully…
Pasting code from another application to Vim is a nightmare. The autoindent features of Vim drive you crazy. How to make it easier to use? Pasting code from another application to Vim is a nightmare. The autoindent features of Vim will drive you crazy. What help you out is the “paste mode”. To paste code…
Many Linux distros, such as RHEL/CentOS 7, Fedora, Ubuntu 16, are now using systemd instead of init as the init system. It is common for Linux users to set Linux to boot to “GUI” or “Text” mode. The old way of changing ‘/etc/inittab’ for choosing Linux runlevels is not working for sytemd. This post will…
How to change the hostname on Linux Mint? The hostname (e.g. mypc or mypc.example.com) can be changed by putting the hostname in one line in the file /etc/hostname on Linux Mint. Read more: How to Change Hostname of Fedora Linux How to get hostname in Python on Linux? Getting Hostname in C Programs in Linux…