Similar Posts
How to process a file line by line in Go?
In the Go programming language, How to process a file line by line? An equivalent piece of Bash code could be while read line ; do echo $line done < ./input.txt You can make use of the bufio package’s Scan(). // open the file filepath f := os.Open(filepath) // create a scanner fs := bufio.NewScanner(f)…
Running Ephemeral Docker Containers – Automatically Remove a Docker Container After Running It
Docker is a convenient tool to quick create containers from different Linux images. If we use the common way to start a docker container like docker run image bash, after the the process exists, the container is still stored there. That is, the docker container persists after it has exited. Sometimes, we would like to…
g++: sorry, unimplemented: non-trivial designated initializers not supported
g++ (version g++ (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)) report: $ g++ -std=c++11 solution.cpp -o sol solution.cpp: In function ‘int main()’: solution.cpp:50:57: sorry, unimplemented: non-trivial designated initializers not supported Stat init_stat {.depth = 0, .moves = tv, .vec = init}; ^ solution.cpp:50:57: sorry, unimplemented: non-trivial designated initializers not supported solution.cpp:50:57: sorry, unimplemented: non-trivial designated initializers…
How to get a script’s directory reliably in Bash on Linux?
How to get a script’s directory reliably in Bash on Linux? For example, to get the directory of the executing script $0. dirname can give you the directory name from the absolute path. You can get the absolute path of the script by readlink -f to handle symbolic links (consider a symbolic link ./run.sh linked…
Are there good free CDNs on the Web
Are there some good free CDNs on the Web? There are some free CDNs in the Web. Cloudflare: https://www.cloudflare.com CloudFlare protects and accelerates any website online. Once your website is a part of the CloudFlare community, its web traffic is routed through our intelligent global network. We automatically optimize the delivery of your web pages…
How to unlock a locked SSH terminal accidentally by ctrl-s on Linux?
I find I sometimes lock the SSH terminal accidentally by ctrl-s on Linux. How to unlock/unfreeze it? Ctrl-s: lock the SSH terminal. Ctrl-q: unlock the SSH terminal. Read more: How to rearrange Alt, Ctrl and Win keys on Linux: Win as Alt and Ctrl/Alt as Ctrl How to Turn GNOME terminal to a Pop-up Terminal…