Mac OSX: Set a global environment variable
Variable Name: SOME_NAMEVariable Value: /etc/somefileTo make the global variable be created every time OS X boots:echo setenv SOME_NAME /etc/somevalue > /etc/launchd.confTo make the global variable...
View ArticleUbuntu Linux: Set a global variable
To set a global variable in Ubuntu Linux that is available even after a reboot, you need to edit /etc/environment and add:VARIABLE=VALUEfor example, you can addEDITOR=/usr/bin/emacs
View ArticlePHP: Which php.ini is being used
To find out which php.ini is being used by your system try:php -i "phpinfo();" | grep php.ini
View ArticleEmacs: Set default tab size
You can set the default tab size in Emacs by adding the following line to your .emacs, replace # with the number of spaces:(setq default-tab-width #)
View ArticleMac OSX, Linux: Get SVN to Ignore a file
To get SVN to ignore a file, i.e. not push it back to the repository even if it changed, you need to do the following:1. Set up your editor, in my case I use emacs, in your ~/.bashrc fileexport...
View ArticleLinux: Send an attachment via the command line
You will need mutt to do this. You can install mutt via your package manager, in Ubuntu you can use:apt-get install mutt To send the attachment you use:mutt -s "The subject of this message" -a...
View ArticleLinux & Mac: Remove files older than a certain date
You can use the following code to remove files older than a certain date:find /path/to/files/* -mtime +numdays -exec rm {} \;Replace /path/to/files with the directory you want to scan, and numdays with...
View ArticleMac OSX & Linux: How to list all DNS records for a domain
To list all the DNS resource records for a domain, you can use nslookup:nslookup -q=any domain.comReplace domain.com with the name of the domain you want to lookup.
View ArticleLinux: Dovecot "save failed waiting for lock error"
If you get the following error:save failed to INBOX: Timeout while waiting for lockThis indicates that Dovecot's locking mechanism somehow got corrupted. To fix you can try the following steps: Stop...
View ArticleLinux & Mac OSX: Remove blank lines from a file with awk
Here is nice awk one liner to remove blank lines from a file, just replace FILENAME with the file you want the blank lines removed from: awk '/./' FILENAMEHere is a sed one liner to remove blank lines...
View ArticleEmacs: Backup Files
Do you find those backup files (somefile~) annoying? If so you can do two things:1. Store them all in a directorymkdir ~/backupAnd add the following to your .emacs:(setq backup-directory-alist `(("." ....
View ArticleMutt: Get mutt to look at your Maildir folders for mail
To get mutt to look at your maildir folders for mail you need two things:1. You need to set your MAIL environment variable in ~/.bashrcMAIL=/home/YOUR_USERNAME/Maildir2. You need to tell mutt about...
View ArticleMac OSX - Starting MySQL
To start MySQL on a Mac OS X machine you can type: sudo /Library/StartupItems/MySQLCOM/MySQLCOM start To stop MySQL on a Mac OSX machine, you can type: sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
View ArticleMac OSX - Set PATH variable
If you want to edit the PATH variable in Mac OSX, you can edit the /etc/paths file and add your entry. The default version looks like this:/usr/bin/bin/usr/sbin/sbin/usr/local/bin
View ArticleMac OSX - View Apache Errors
To view Apache errors, you have to look at the error log file called error_log. It is either in /var/log/httpd, or /var/log/apache2 depending on your Apache setup. You can see the most recent errors by...
View ArticleFind modules loaded in iptables
To find out what modules are loaded in iptables try:cat /proc/net/ip_tables_matches
View Articleiptables Port Forwarding
If you need to forward one port to another you can type:iptables -t nat -A PREROUTING -i eth0 -p udp --dport SOURCEPORT -j REDIRECT --to-port DESTPORTSo if you wanted to route all traffic from port...
View ArticleBlocking domains with BInd 9 like WebEx
You can block domains with bind 9 by first creating a dummy zone file called "poison" that has no records (copy the following file exactly):@ IN SOA ( ns1.domain.com. hostmaster.domain.com. 1...
View ArticleUbuntu, CentOS ssh hangs when you try to log in
You may encounter a server where ssh hangs when you try to login. Sometimes this error is due to a missing DNS record. You can fix this by editing your /etc/ssh/sshd_config file on the server to have...
View Article
More Pages to Explore .....