Run cron jobs with environmental variables for an account

Posted on

A common error for configuring cron is to use environmental variables for an account in the cron command. However, cron will run the commands without these variables defined. In the crontab -e, adding . $HOME/.profile before the commands play the trick. For example: 0 */8 * * * . $HOME/.profile; ~/bin/my-command Cron is started by
Read more

Excerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen

Posted on

Excerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen. Also add the “read more” link after the excerpt. The patch: diff –git a/wp-content/themes/twentythirteen/content.php b/wp-content/themes/twentythirteen/content.php index 4f61b22..53b4686 100644 — a/wp-content/themes/twentythirteen/content.php +++ b/wp-content/themes/twentythirteen/content.php @@ -30,7 +30,7 @@ </div><!– .entry-meta –> </header><!– .entry-header –> – <?php if ( is_search() ) : // Only display
Read more

How to change the maximum execution time and memory size allowed for PHP

Posted on

I see this message in the error log of httpd: PHP Fatal error: Maximum execution time of 30 seconds exceeded in and PHP Fatal error: Allowed memory size of 268435456 bytes exhausted How to change them to a longer and larger value? To change the allowed maximum memory usage of PHP: Set memory_limit = 256M
Read more

How to spawn a background process in a bash script

Posted on

For example, I want to spawn many ssh background processes in one bash script: for i in `cat ./all-hosts` do ssh $i “ifconfig | grep Link” done Simply adding a & to the ssh commands does not work. Here is the script that works: for i in `cat ./all-hosts` do ssh $i “ifconfig | grep
Read more

How to install Scala on Fedora Linux

Posted on

This tutorial introduces how to install Scala 2.9.2 on 64-bit Fedora Linux 17. There are some changes needed to make scala work on Fedora Linux 17. Please check it out in the answer. Install Java Scala depends on Java, so please install Java first. In this tutorial, we installed JDK to: /usr/java/jdk1.6.0_24/lib/. Install Scala from
Read more

How to install Scala from the official Scala distribution

Posted on

How to install Scala from the official Scala distribution? This is needed on a Linux release with older version of Scala in the repository, e.g. Fedora 12. Use the install-scala.sh script: # wget https://raw2.github.com/zma/usefulscripts/master/script/install-scala.sh # sh ./install-scala.sh VER where VER is the scala version that you want to install. First step, install and configure the
Read more

Where are the Linux routing table entries stored on disk?

Posted on

I know the routing tables on Linux is in memory after being set. However, where are the routing table entries stored on disk? I mean where are the routing table is persistently stored so that the routing table can be reloaded like the iptables (under /etc/sysconfig/iptables on Fedora/RHEL/CentOS Linuxes). If the system uses the /etc/rc.d/init.d/network
Read more

How to use OCaml as a script language?

Posted on

How to use OCaml as a script language like bash and python? It will be good that I can write a script in OCaml and directly invoke it. For example, I write a script named “script.ml” and then I can invoke it directly by $ ./script.ml Thanks! Three helloworld scripts: script3.ml #! /usr/bin/env ocaml print_string
Read more

Is cin much slower than scanf in C++?

Posted on

I frequently hear that cin is significantly slower than scanf in C++. Is this true? And how to improve the efficiency of cin? It is really nice to use most of time. One discussion about that cin is very slow is here: http://apps.topcoder.com/forums/?module=Thread&threadID=508058&start=0&mc=7 In short: cin is not always slower (can be faster actually, see
Read more

Consistency models for distributed systems

Posted on

Which are the consistency models used for distributed systems? Papers that survey the consistency models Robert C. Steinke and Gary J. Nutt. 2004. A unified theory of shared memory consistency. J. ACM 51, 5 (September 2004), 800-849. DOI=10.1145/1017460.1017464 http://doi.acm.org/10.1145/1017460.1017464 David Mosberger. 1993. Memory consistency models. SIGOPS Oper. Syst. Rev. 27, 1 (January 1993), 18-26. DOI=10.1145/160551.160553
Read more

How to restore a Gnome 3 session?

Posted on

How to restore a Gnome 3 session? Which means: opening all the programs running last time when I log out in Gnome 3. If your purpose is to automatically start programs after logging in Gnome, another possible method is using the autostart script: https://www.systutorials.com/qa/119/how-to-write-a-autostart-script-for-gnome Run gnome-session-properties. In the “Options” tab, select “Automatically remember running applications
Read more