September 11, 2009, 12:40 pm
To control VMware Workstation Virtual Machines from the command line use the vmrun utility. For instance, to stop a running virtual machine use this command:
For a comprehensive guide on vmrun take a look at this document.
September 5, 2009, 6:41 pm
By default Latex indents all the paragraphs except the first paragraph of the section. To modify this behavior include the indentfirst package in your document’s preamble:
September 2, 2009, 4:55 pm
I’ll be using my Gmail account to send mail. The first step is to configure the local Postfix server as a relay. Edit /etc/postfix/main.cf:
sudo vim /etc/postfix/main.cf
Search for a “relayhost=” line and add the following after it:
relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_sasl_local_domain = yourdomain.com
#smtpd_sasl_application_name = smtpd
broken_sasl_auth_clients = yes
smtpd_pw_server_security_options = noanonymous
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
Next create /etc/postfix/sasl_passwd and add the following (replace username and password accordingly):
smtp.gmail.com:587 username@gmail.com:password
Next run the following commands:
$ sudo postmap hash:/etc/postfix/sasl_passwd
$ sudo chown root:wheel /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
$ sudo chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
You should be able to send mail from the command line now:
$ mail -s "Test" username@domain.com
You can check mail’s log file at /var/log/mail.log
To be able to send attachments from the command line (true attachments that graphical mail clients understand) install mutt:
$ curl -O ftp://ftp.mutt.org/mutt/devel/mutt-1.5.20.tar.gz
$ tar xfzvv mutt-1.5.20.tar.gz
$ cd mutt-1.5.20/
$ ./configure
$ make
$ sudo make install
To send attachments use the following command:
echo "text body" | mutt -s "subject" -a file.dat -- username@domain.com
Or even better:
for i in {1..1000}; do echo "text body" | mutt -s "subject" -a file.dat -- username@domain.com; done
Happy mailing!
September 1, 2009, 11:33 am
Have you ever been curious about the first registered domain name? Well, it was symbolics.com.
August 31, 2009, 9:35 am
First upload your public key to the server you want to log in:
scp .ssh/id_rsa.pub user@1.2.3.4:/home/user
On the server, add the public key file to the authorized_keys file:
cat id_rsa.pub >> .ssh/authorized_keys
Now you can login using public key authentication and you don’t have to enter a password anymore.
August 28, 2009, 9:47 am
To find which servers handle mail for a particular domain use dig:
;; QUESTION SECTION:
;google.com. IN MX
;; ANSWER SECTION:
google.com. 561 IN MX 100 google.com.s9a1.psmtp.com.
google.com. 561 IN MX 100 google.com.s9a2.psmtp.com.
google.com. 561 IN MX 10 smtp1.google.com.
google.com. 561 IN MX 10 smtp2.google.com.
google.com. 561 IN MX 10 smtp3.google.com.
google.com. 561 IN MX 10 smtp4.google.com.
August 24, 2009, 7:28 pm
To display hidden files in Finder type the following commands in the Terminal:
$ defaults write com.apple.finder AppleShowAllFiles TRUE
$ killall Finder
August 23, 2009, 5:27 pm
To add new packages to your Mactex installation follow these steps:
$ mkdir ~/Library/texmf/tex/latex/newpackage/
$ cp newpackage.sty ~/Library/texmf/tex/latex/newpackage/
That’s it. No need to re-index package list or something.
August 13, 2009, 1:13 pm
I’m using Doxygen to document some C source code. This tool generates multiple sections in the Latex document (one for each variable). These sections are empty (i.e. they only have a title, no text). The problem is that Latex doesn’t automatically break the page when it should, and the section titles go beyond the margins (in fact many titles are not displayed at all).
To solve the issue add the following code to the document’s preamble:
1
2
3
| \makeatletter
\renewcommand\@afterheading{}
\makeatother |