-
GNU sed, replace search string with contents of a file
Say, I want to replace the text “replace me” in all the .txt files in the current directory with the contents of modified.js file find . -name “*.txt” -print0 | xargs -0 sed -i -e ‘s/replace me/cat modified.js/e’ Notice the ‘/e’ at the end and that seems to do the trick.
-
jQuery empty(),remove() and Thickbox
I am a great fan of thickbox and I have used it for a long time. Recently I came across a situation where trying to close a modal that had a table with around 7000 rows (each 8 columns) crashed the tab in Chrome and took a very long time in Firefox. I went through…
-
Unix find, xargs and basename.
Xargs is great. If you want to know why use xargs over exec, have a read of this: xargs versus exec. But, there is one problem. If the command that you are trying to execute on the results from find cannot take more than one file as param (basename for e.g, can take only one…
-
Munin: Could not open required defaults file: /root/.my.cnf
For some reason I kept getting this error (even when the file was readable by all) in one of the munin (mysql slave) plugins that I had written. So this was the solution that worked for me; under the [mysql*] section in /etc/munin/plugin-conf.d/munin-node I added this: env.mysqlopts -u{user} -p{password} and in my plugin I did…
-
Fixing: “unknown terminal type” in shell
Assuming you are using bash Add the following to ~/.bash_profile TERM=vt100 export TERM and then from shell source ~/.bash_profile Note: ‘vt100’ could be replaced with something similar in /usr/share/terminfo/
-
MySQL KEY, PRIMARY KEY and NOT NULL.
Have a look at this sql statement: mysql> CREATE TABLE `t1` (`id` INT NULL AUTO_INCREMENT, KEY(`id`)); Query OK, 0 rows affected (0.92 sec) mysql> SHOW CREATE TABLE `t1`; +——-+————————————————————————————————————————-+ | Table | Create Table | +——-+————————————————————————————————————————-+ | t1 | CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |…
-
Q&A Site covering Religion and Philosophy
I have now been hosting a Q&A site covering 2 of my favorite topics: Religion and Philosophy. Link: bayankaram.com. The name “bayankaram” refers to the legendary Sri Prativadi Bhayankaram Annan Swami who composed Suprabhatham.
-
Wireless connection dropouts in Lucid Lynx
Since my upgrade to Lucid, I have been experiencing dropouts on my wireless connection and since the solutions that I had found on the net did not solve the above problem, I decide to script a temporary fix until it gets fixed in (K)Ubuntu or in the Kernel. I found that that after I get…
-
DNS Zone File Serial
Today, I came across this error while checking a DNS Zone file for error (I was trying to script the syntax check of a zone file before deploying it onto our production servers): named-checkzone example.com example.com.zone dns_rdata_fromtext: example.com.zone:3: near ‘201005051010’: out of range zone example.com/IN: loading from master file example.com.zone failed: out of range And,…
-
Lucid Lynx — Downgrading from PHP 5.3
I hit this bug after the upgrade to PHP 5.3 (which happened with my Kubuntu Upgrade to Lucid Lynx). I read in another bug report that this issue was fixed in the latest snaphshot, so I tried compiling from source – using the latest 5.3 snapshot. This didn’t go well, as I hit a seg…