Archive for the 'unix' Category

Rewriting shell-scripts in ruby

September 8, 2008

Just a note to myself (before I start some real work), that I’ve gotta rewrite some of my most used shell scripts in ruby, and write future ones in ruby. Reasons for frustration with bash scripting:
- if and loop syntax gets me
- unpredictable behavior of unix commands due to differences between gnu, macport and bsd [...]

Automating export of Firefox 3 bookmarks and history from command-line/cron

September 3, 2008

Firefox 2 used a bookmarks.html file for bookmarks. History was in a mork file that was incomprehensible. Firefox 3 uses SQLite for both these. Export manually is simple from the Bookmarks-Organize Bookmarks menu option. This page gives us info on how to automate bookmarks export using about:config, however this export happens:

[...]

Getting gmx to work without novalidate-cert

September 2, 2008

This was simple (thanks to madboa)

openssl s_client -connect www.gmx.com:443

This gives an output. Copy the begin certification to end certificate part and place in a file named gmx.pem.
It should look like this (lines deleted in between):

—–BEGIN CERTIFICATE—–
MIIDUzCCArygAwIBAgIQIvcebQE7u+QGIM7tD/CuCjANBgkqhkiG9w0BAQUFADCB
zjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ
qPqkqsLcZWVrMrGQsc0MXhixYXVns4aHpkeXfUPbFr/Cv9ly5NAa
—–END CERTIFICATE—–

openssl x509 -in gmx.pem -hash -noout

#(this outputs: ca09c2c4)

cp gmx.pem ca09c2c4.0

#(copy the .0 file to the location pointed to by [...]

Alpine TLS: unable to get local issuer certificate

September 1, 2008

Currently, my alpine connects to smtp.gmail.com with the /novalidate-cert option, meaning my password is sent in the clear. The communication is not encrypted. Strangely, I have configured postfix to use TLS with the roots.zip certs. The logs clearly show the TLS handshake. Similarly, fetchmail also shows it is using TLS with gmail.
However, alpine [Alpine 1.10 [...]

OS X Leopard: So it is /etc/paths.d or /etc/paths ?

August 31, 2008

So, as always, my shell script runs fine on the terminal, but bombs as a cron-job! The PATH variable for the system is different.
Leopard now requires us the create a file in /etc/paths.d (see this). Did not work for me! In any case, that does not let me specify the order of inclusion.
There’s also a [...]

Getting postfix to use gmail as relay host

August 23, 2008

Postfix seemingly comes with Mac OS X Leopard, ready to run out of the box. I have a laptop, and am not hosting a mail server. I have a dynamic IP which means gmail won’t accept my mails.
So “ditch postfix” is the first thought. I did, and wrote my own python script to replace mail/mailx [...]

Getting Categories using Unix Blogger

March 19, 2007

Aaah! In order for labels to be displayed on Google’s Blogger the scheme needs to be mentioned too.
<category scheme=”http://www.blogger.com/atom/ns#” term=”blogger”/>
Now labels will come through while blogging with blogger.sh.
~~~
Feeling amorous, she looked under the sheets and cried, “Oh, no,
it’s Microsoft!”

Inconsistencies in Unix programs

March 19, 2007

I use the command-line all the time, as well as ruby and Vim. I also use regular expressions all the time.
With all the brains going behind the various unices/unixes one would expect consistent handling of regexes across various unix programs on one system.
While vim does take “\d” in place of [0-9], however, it requires escaping [...]

A ONE-line signature rotator

March 16, 2007

If you have a file with quotations, verses or whatever that you would like to print out like the fortune program or rotator, you need do only the following:
1. break the file in to multiple files, one for each quote, or verse.
perl -pe ‘BEGIN {$n=1} printf ” — Author’s name\n” and open STDOUT, “>$ARGV.$n” [...]

Power Blogging from Unix (and Vim)

March 15, 2007

The benefit of using a unix shell (Unix/Linux/Mac OS X) for blogging is not just that one can use one’s favorite editor, such as Vim, or even something absolutely freakingly great such as html.vim, but also …
One painful part of blogging can be creating hyperlinks. There are links in your browser bookmark file, and links [...]