Skip to content


CLI Blogging code

Bookmark this category
How it’s done. I started out with a bash function as described earlier. The function code is below:
function blog() { echo "$2" | mail -s "$1" address@example.com; }

Then I noticed I would need more freedom to write longer text, without leaving the shell. So here goes the “blog” bash script. I’m using the postie wordpress plugin on the server side, so things are a bit more manageable. I may add more to this later if I get time.

#!/bin/bash
if [ -n "$2" ]; then
BODY=$2
else
vi tmpfile; BODY=`cat tmpfile`; rm tmpfile
fi
if [ -n "$1" ]; then
SUBJECT=$1
else
echo -n "Subject:"; read SUBJECT
fi
echo "$BODY" | mail -s "$SUBJECT" address@example.com

Similar Posts:

Posted in Blogging.

Tagged with .


Another CLI post (via postie)

Bookmark this category
Testing CLI blogging with temp files and VI integration. weeee!

Similar Posts:

Posted in Blogging.


Live From The Field (via postie)

Bookmark this category
Another CLI post

Similar Posts:

Posted in Blogging.


CLI blogging with Postie (via postie)

Bookmark this category
Another blogging test using the postie plugin

Similar Posts:

Posted in Blogging, Tools.

Tagged with , , , .


Quick Note

Testing the previous entry, and quick-blogging from the shell

Similar Posts:

Posted in Blogging.

Tagged with , , .


Dave’s Notepad

We were chatting in the morning and my colleague Dave said:

echo “blog post about distro choice” | mail -s “blog post” david@mydomain.org
that’s my ‘notepad’. :)

I thought that was pretty useful, but tried to make it easier by creating a bash alias. Turns out it’s better to use a bash function instead. (see this note). So my ‘jot’ function is:
function jot() { echo "$1" | mail -s "$2" abdallah@mydomain.com; }

I also noticed, that emails sent from my laptop were not reaching. It seems Ubuntu comes with Exim4 as a default MTA. I’m not too familiar with Exim, so I used the occasion to learn a new trick.

I might use this for micro-blogging next… let me go set it up :)

Similar Posts:

Posted in Blogging, Coding, Tools.

Tagged with , , , , , , , , , .


Moving SVN repository

I moved the svn repository from my laptop to the server for easier deployment of http://mybox.grat.in
Here are the commands I used:

on laptop:
svnadmin dump /var/svn/repos/ > home-repository.dmp
gzip home-repository.dmp
scp -P39227 home-repository.dmp.gz mybox.server.xx:/home/myuser

on server:
mkdir -p /var/svn/repos
gunzip home-repository.dmp.gz
cd /var/svn/repos/
svnadmin load /var/svn/repos < /home/myuser/home-repository.dmp

again on laptop:
edited ~/.subversion/config:
[tunnels]
sshtunnel = ssh -p 39227

then:
svn switch --relocate file:///var/svn/repos/ svn+sshtunnel://mybox.server.xx/var/svn/repos/

And check it's all good (in the working copy directory):
svn up
svn info

Piece of cake :)

Similar Posts:

Posted in Coding, Work.

Tagged with , , , .


Redirect all traffic to https

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Similar Posts:

Posted in Work.

Tagged with , , , .


Handyman

I’m not really the handy-man type. But it’s been frustrating to depend on others to setup the simplest things. So, last week I went shopping for some tools..

I found a good deal on a “Bosch” impact drill with a bunch of spare drills and other “accessories”.

I also got some shelves from the mall: those turned up nicely as a makeshift closet while we’re waiting for the IKEA closet to arrive by ground delivery from KSA (thanks Juliano for taking the trouble to send us those!)

Later, I got some hooks and setup a clothesline with some wires. That looked really good :)

After that, I setup some door stoppers, a plastic net so “the boss” (our cat) can go out to the balcony without venturing “outside” to the garden.

Next on my list is setting up a metal closet/racks in the office room. Also for the office, I’m getting a large white-board and a black foam board. Plenty to do and it’s lots of fun (so far).

Going back to my day job now!

Similar Posts:

Posted in Married Life, Mood, Tools.

Tagged with , , , .


Wordpress + SVN + Auto-update

I’ve been using the latest cutting edge wordpress from svn for a while now and it’s been good. At the time of the writing

You are using WordPress 3.0-alpha.

Basically, even the latest code is safe(ish) and things don’t break easily.

I’m not using it for “production” per se, as the only other person who ever reads this blog is probably me!

So, here’s how I do it:

svn up

If you expected more, there’s really not much there. As everything is pretty simple to setup as per the notes in http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion

Some would only want to update to “stable” version. Others, like me will follow the absolute latest.

Now, how about the permissions for the directory where wordpress is setup. Here’s what I use:

my username: wpuser

apache user: nobody

wordpress installation directory: /home/wpuser/public_html/

cd /home/wpuser/public_html

chown -R wpuser:nobody

find . -type d -exec chmod 755 {} \;

find . -type f -exec chmod 644 {} \;

With the above, it’s easy to upgrade simply by going:

su wpuser

svn up

Now, the automatic upgrade/setup for plugins should work perfectly from within wordpress’ admin interface. If it doesn’t you might want to add the following in wp-config.php:

// Additional variables to allow auto update

define('FS_CHMOD_FILE',0644);

define('FS_CHMOD_DIR',0755);

define('FS_METHOD', 'direct');

I hope this helps someone out there. Give me a shout if it does ;)

Similar Posts:

Posted in Blogging, Coding, Work.

Tagged with , , , , .