The posix_spawn() and posix_spawnp() functions create a new child process from the specified process image constructed from a regular executable file. It can be used to replace the relative complex “fork-exec-wait” methods with fork() and exec(). However, compared to fork() and exec(), posix_spawn() is less introduced if you search on the Web. The posix_spawn() manual
Read more
Tag: www
Hadoop Installation Tutorial (Hadoop 2.x)
Posted onHadoop 2 or YARN is the new version of Hadoop. It adds the yarn resource manager in addition to the HDFS and MapReduce components. Hadoop MapReduce is a programming model and software framework for writing applications, which is an open-source variant of MapReduce designed and implemented by Google initially for processing and generating large data
Read more
Extending Mounted Ext4 File System on LVM in Linux
Posted onLVM is a great tool to manage hard disks on Linux—you can abstract the hard drives away and manage logical volumes from volume groups, you can dynamically add or remove hard drives while the file systems on the logical volumes need not to backed up and recovered, and you may create many snapshots of the
Read more
Keyboard Key Mapping for Emacs: Evil Mode and Rearranging Alt, Ctrl and Win Keys
Posted onCtrl keys are important and possibly most frequently used in Emacs. However, it is painful on today’s common PC keyboards since Ctrl keys are usually in the corner of the keyboard main area. Why the key mappings in Emacs are designed like this? After it was designed, Emacs was commonly on the Lisp Machine keyboards
Read more
How to Create Fedora 20 Domain-U on Fedora 20 Domain-0
Posted onIn this post, creating a file-backed virtual block device (VBD) and installing Fedora 20 in the Xen DomU via internet will be introduced. This domain is created on a Fedora 20 Dom0 as introduced in https://www.systutorials.com/installing-xen-on-fedora-20-as-domain-0/. For better performance, you may consider using LVM backed VM. Create file-backed VBD The actual space of VBD will
Read more
Cheatsheet: Git Branching with a Git Server
Posted onIt is common to set up git servers to host git repositories. Branching is lightweight in git and a very friendly mechanism to manage code. Here, I summarize a cheatsheet of common git branching commands for working on repositories from a git server. This post assumes that you have basic knowledge with git. If you
Read more
Useful Git Submodule Commands
Posted ongit submodule is a very useful tools in git to include other git repositories in one repository to handle cases such as library dependencies. In this post, I summarize some commonly used commands that I find useful for working with git submodule. For the list of full commands, check the git submodule manual. Add a
Read more
How to Catch the Signal Sent by Kill in C on Linux
Posted onPrograms may want to catch the kill signals sent by the kill command in C programs on Linux so that it can gracefully shutdown itself before it is killed. For example, I have a daemon progd running, and it may be killed by pkill progd. The progd may want to save some in-memory state to
Read more
How to Install, Run and Uninstall VMware Player and VirtualBox on Fedora Linux
Posted onVMware Player and VirtualBox are two cool and free full virtualization solutions and both can run on top of a Linux host. In this post, I introduce how to install, run, and uninstall VMware Player and VirtualBox on Fedora Linux. VMware Player Install VMware Player Download the installation bundle from VMware’s website. For example, the
Read more
Git through SSH Tunnel as Proxy
Posted ongit is a great tool and it is common to have a git server over SSH possibly managed by gitolite. However, there are situations that we can not directly connect to the git server but be able to SSH to another node that can connect to the git server. The git server may allow only
Read more
Directly SSH to Hosts’ Internal IPs Through the Gateway
Posted onWe have many hosts with internal/LAN IPs like 10.0.3.* behind a gateway and the hosts with LAN IPs can connect to the Internet through the gateway. We used iptables to forward port from the gateway to internal IPs so that users from hosts with Internet connections can SSH to the gateway’s forwarded port to log
Read more
Improving ssh/scp Performance by Choosing Suitable Ciphers
Posted onUpdate on Oct. 9, 2014: You should be aware of the possible security problems of blowfish and it is suggested not to be used. Instead, you may consider ChaCha20 as suggested by Tony Arcieri. To use this with OpenSSH, you need to specify the Ciphers in your .ssh/config files as chacha20-poly1305@openssh.com possibly with another default
Read more
Making Emacs Start Up Faster
Posted onI use Emacs in terminals and start/close Emacs frequently as needed like in a file checking-editing-closing loop. However, Emacs seems take some time to start up especially some heavy modes are used. How to make Emacs start up faster? (If you just want the solution/script first, find the command in the summary section.) My solution
Read more
Customizing Fonts in Gnome 3
Posted onGnome 3 is great and I can understand that it emphasizes on simplicity. However, the configuration settings for Gnome 3 does not provide tools for certain functions that I need. One of them is customizing the fonts. This post will summarize the tools/tips that I adopted to customize the fonts in Gnome 3. Usually, the
Read more
How to Set Up A Gitolite Git Server – A Ten-Minute Tutorial
Posted onI ever introduced seting up git server using SSH or gitosis. However, gitolite is the way to go for managing git servers if you want an lightweight authentication layer. gitolite provides many very usefull features which can control each user’s right on each branch. I set up one gitolite git server and am very happy
Read more
RAII-like Error Handling and Resource Management in C
Posted onError handling and resource management are pervasive in programs. RAII originated in C++ is great. With RAII, it is much easier to write easy-to-read code that allocats/deallocats resources in the constructor/destructors. By representing a resource with a local object, we are sure that local object’s destructor will release the resource and will not forget to
Read more
How to Connect to Remote Servers by VNC on Windows
Posted onSoftware you will need 1, Putty 2, Real VNC viewer 3, twm (lightweight desktop). On fedora (centos, redhat): sudo yum install twm (on other distros, you may need other commands, or download source code and install it). Specific steps 1, Enter your Host name and port in putty. 2, Set port forwarding in putty Tunnels.
Read more
PHP Photo Gallery Scripts Requiring No Database
Posted onIt is nice to set up some photo gallery on the web and share with friends and family. Some online services are good and convenient. But if you want to host it on your own domain and control them by yourself, there are also many scripts available. Usually, we want the script simple to use
Read more
Statically Linking C and C++ Programs on Linux with gcc
Posted onBefore statically linking you C and C++ programs, you should be aware of the drawbacks of the static linking especially with glibc. There are some good discussions already: with glibc you’re linking static programs which are not really static and some others here and here. That said, you can choose to statically link C and
Read more
Auto Indenting for OCaml Code in Vim with ocp-indent
Posted onThe built-in indenting in Vim for OCaml seems not very good. How to set up auto indenting for OCaml code in Vim? ocp-indent works very well for me. This posts introduces how to configure Vim to use ocp-indent to automatically indent/format OCaml code. First, install ocp-indent after installing opam: $ opam install ocp-indent Second, configure
Read more