How to get the top committers in git? Like in github: But plain text is fine showing number of commits and author names/emails sorted by the number of commits. You may use this command: git log | grep Author | sort | uniq -c | sort -n -r Here, count the number of commits by
Read more
Tag: R
How to install Windows from USB drive?
Posted onI have downloaded the iso file of Windows 10 installation disk from https://www.microsoft.com/en-us/software-download/windows10ISO . But I do not have a DVD R/W drive. Whether and how to install Windows from a USB drive? You can use the Windows USB/DVD Download Tool to make a USB from the Windows ISO. Download and install the Windows USB/DVD
Read more
How to do diff like `git diff –word-diff` without git on Linux?
Posted onThe result of git by git diff –word-diff is great. But how to do diff like git diff –word-diff without git on Linux? The plain diff command on Linux seems not accept options like –word-diff. The wdiff is for word-diff: wdiff program is a front end to diff for comparing files on a word per
Read more
How to redirect WordPress search query to Google CSE?
Posted onHow to redirect WordPress search query to Google CSE? You can configure Google CSE to read the query variable (by default, it is q). Then, in your WordPress’s .htaccess file, add these 2 lines RewriteCond %{QUERY_STRING} ^s=(.*)$ RewriteRule ^ https://www.google.com/cse/publicurl?cx=xyz&q=%1 [R,L] Here, “https://www.google.com/cse/publicurl?cx=xyz” is your CSE’s public URL or the webpage that contains the Google
Read more
VirtualBox report “Kernel driver not installed” on Fedora 21
Posted onVitualBox is installed on Fedora 21 by # yum install VirtualBox The following packages are installed kmod-VirtualBox-3.18.7-200.fc21.x86_64-4.3.20-4.fc21.4.x86_64 VirtualBox-4.3.20-3.fc21.x86_64 There is the kernel modules package installed. However, when running virtualbox (after reboot), it reports: [zma@laptop:~]$ virtualbox WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (3.18.7-200.fc21.x86_64) or
Read more
How to force a website to use https by htaccess settings?
Posted onI would like my site to be accessed by https only. How to force a website to use https by htaccess settings by redirecting http requests to the corresponding https ones? You can check the method of redirecting http to https at: https://www.systutorials.com/qa/1033/how-to-redirect-http-to-https-in-apache-with-mod_rewrite If you would like to have a 301 redirect, you can use
Read more
How to email admins automatically after a Linux server starts?
Posted onManaging a cluster of servers, I would like to notified when a server is started. How to make the Linux servers email me or other admins automatically after they are started? I did this by adding a crontab entry on each servers like @reboot date | mailx -S smtp=smtp://smtp.example.com -s “`hostname` started” -r zma@example.com zma@example.com
Read more
How to add a new HDFS NameNode metadata directory to an existing cluster?
Posted onWe have a running HDFS cluster. Currently, the NameNode metadata data directory has only one directory configured in hdfs-site.xml: <property> <name>dfs.namenode.name.dir</name> <value>file:///home/hadoop/hdfs/</value> <description>NameNode directory for namespace and transaction logs storage.</description> </property> We would like to add a new directory for dfs.namenode.name.dir to make replicas of the metadata on a separated disk for higher data reliability.
Read more
Fixing “Remote Host Identification Has Changed” Error When SSH to a Server
Posted onIf you encounter an error message like the one below when attempting to SSH to a server: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has
Read more
How to add a “status bar” to screen on Linux?
Posted onI noticed that some guys’ screen console has a status bar with tab numbers. That will be very useful for 1) know you are using screen rather than a normal terminal. 2) which tab you are working in. Below is my ~/.screenrc: hardstatus alwayslastline hardstatus string ‘%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]’ It
Read more
How to check the replication factor of a file in HDFS?
Posted onA related question: how to find the replication factors of files in a HDFS cluster? method 1: You can use the HDFS command line to ls the file. The second column of the output will show the replication factor of the file. For example, $ hdfs dfs -ls /usr/GroupStorage/data1/out.txt -rw-r–r– 3 hadoop zma 11906625598 2014-10-22
Read more
How to change number of replications of certain files in HDFS?
Posted onThe HDFS has a configuration in hdfs-site.xml to set the global replication number of blocks with the “dfs.replication” property. However, there are some “hot” files that are access by many nodes. How to increase the number of blocks for these certain files in HDFS? You can the replication number of certain file to 10: hdfs
Read more
How to install Adobe Reader on Linux Mint 17?
Posted onHow to install Adobe Reader on Linux Mint 17? First, add Canonical PPA repository sudo add-apt-repository “deb http://archive.canonical.com/ precise partner” Then, update apt cache and install Adobe Reader sudo aptitude update sudo aptitude install acroread You can select “Yes” to set Adobe Reader as the default PDF viewer or “No” to not set it. E.Z.M.,
Read more
Generating TAGS file for Emacs recursively?
Posted onHow to generating TAGS file for Emacs recursively? etags seems not support recursively generating TAGS file. I use ctags instead. It can also generate TAGS file for Emacs with the -e option: ctags -e -R . You can also use etags with find: find ./ -print | xargs etags But I prefer the ctags way.
Bash comparison operators
Posted onWhat are all the bash supported comparison operators? The man 1 test contains all the operators supported in bash. An omitted EXPRESSION defaults to false. Otherwise, EXPRESSION is true or false and sets exit status. It is one of: ( EXPRESSION ) EXPRESSION is true ! EXPRESSION EXPRESSION is false EXPRESSION1 -a EXPRESSION2 both EXPRESSION1
Read more
Should I buy a Kindle paperwhite or regular Kindle?
Posted onShould I buy a Kindle paperwhite or regular Kindle? Actually, you can click the following link to get the answers :-)http://www.reddit.com/r/kindle/comments/16in81/should_i_get_a_paperwhite_or_regular_kindle/
utop key bindings / key shortcuts
Posted onutop is an improved toplevel for OCaml supporting line edition, history, real-time and context sensitive completion, colors and etc. utop is convenient to use. However, the key bindings are a little bit different from the ones with GNU readline. What are all the key bindings? The #utop_bindings command will print all the key bindings. Here
Read more
Xen HVM DomU configuration file
Posted onAn example of Xen HVM DomU configuration file. An example for install the OS from an ISO: name=”10.0.1.235″ vcpus=2 memory=2048 shadow_memory=8 disk=[‘file:/lhome/xen/vm-10.0.1.235/vmdisk0,xvda,w’, ‘file:/lhome/Linux-x86_64-DVD.iso,xvdc:cdrom,r’] vif=[‘bridge=xenbr0′] kernel=’/usr/lib/xen/boot/hvmloader’ builder=’hvm’ device_model=’/usr/lib64/xen/bin/qemu-dm’ extra=” vnc=1 vnclisten=”0.0.0.0″ vncpasswd=’1234567′ # vncdisplay=1 vncconsole=1 on_reboot=’restart’ on_crash=’restart’ An example for run the VM after installation: name=”10.0.1.235″ vcpus=2 memory=2048 shadow_memory=8 disk=[‘file:/lhome/xen/vm-10.0.1.235/vmdisk0,xvda,w’] vif=[‘bridge=xenbr0′] kernel=’/usr/lib/xen/boot/hvmloader’ builder=’hvm’ device_model=’/usr/lib64/xen/bin/qemu-dm’ extra=” vnc=1
Read more
Plain text file pipelined to Linux mailx turns to “Content-Type: application/octet-stream” (an attachment)
Posted onPlain text file pipelined to Linux mailx turns to “Content-Type: application/octet-stream” which is recognized as an attachment by some email client. The command is like this: $ cat log.txt | mail -s “Updated log file” -r “from@example.com” “to@example.com” I expect it to be: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit But it turns out to be: Content-Type:
Read more
How to list a git repository’s all branches on the remote server?
Posted onI can list all local branches by git branch How to list a git repository’s all branches on the remote server? You need the -r option: git branch -r From the man page of git-branch. -r List or delete (if used with -d) the remote-tracking branches.