New blog setup with tinkerer.

I finished migrating this site to tinkerer from o-blog in this weekend. Even though I liked the idea of blogging with org-mode and the fresh look of o-blog it had few problems. One of major problem is that it is painfully slow to load the pages because of heavy use of javascript which is against point of having a static website. It is also true that the source files are not pure org-mode markup.

Anyhow I decided to move from away from it. Why tinkerer instead of famous jekyll blog engine. I have some familiarity with python and I liked the idea that Tinkerer is just tiny layer over documentation generator sphinx.

The migration was not at all the difficult. I have small number of pages (less than 10 at this point) and turning org-mode source files to rst was semi automatic. Though org-mode doesn’t support exporting org to rst, I made use of org html exporter and html2rst for the conversion and with some manual tweaking.

One of the main reason for the migration is I want to write more and o-blog was putting me slightly off. I want to reduce any unsolicited friction that hinder me in writing.

For the sake of!!!

I got this idea of “for the sake of”.

It started with the idea of “read for the sake of write”. i.e., if you can’t write by which you consolidate learning from reading it whole reading aspect goes waste.

Similarly.,

  • learn for the sake of teach.
  • watch for the sake of show.
  • hear for the sake of speak.
  • and so on.

In all cases one should remember that the central idea is here to improve ourselves and the world around us for better but not to acquire false pride.

What would you say.?

Emacs Tip: just-one-space

In writing text or even code in Emacs, lets say you have some thing like this

a friend of mine _        has gone to build a Snow-Man.

The cursor is at _ in the above example. So you need to remove the unnecessary spaces in the sentence.

One way to do this is pressing M-` delete all the spaces in between and `SPC. That is fine what if you have new lines like this

A friend of mine _


        has gone to build a Snow-Man.

Its very painful to bring them to gather.

That is where M-x just-one-space comes in. With a negative argument it takes care of any number of newlines. This is the code I use to handle this

(define-key global-map (kbd "C-|")
  (lambda ()
  "place only one space in between at the point"
  (interactive)
  (just-one-space -1)))

Try this, it will definitely come handy. Of course change C-| to your convenient key chord.

Bash navigation is made easy.

Moving between the folders in a bash shell is the most painful thing. How cool it would be to have bookmarks and cd to them without writing all the path name. So here is how you can add bookmarking functionality to your bash shell. works great and I use all the time.

# I got this from http://hayne.net/MacDev/Bash/aliases.bash
# and made few changes by my own
if [ ! -f ~/.dirs ]; then  # if doesn't exist, create it
    touch ~/.dirs
else
    source ~/.dirs
fi

alias L='cat ~/.dirs'

G () {              # goes to distination dir otherwise , stay in the dir
    cd ${1:-$(pwd)} ;
}

S () {              # SAVE a BOOKMARK
    sed "/$@/d" ~/.dirs > ~/.dirs1;
    \mv ~/.dirs1 ~/.dirs;
    echo "$@"=\"`pwd`\" >> ~/.dirs;
    source ~/.dirs ;
}

R () {              # remove a BOOKMARK
    sed "/$@/d" ~/.dirs > ~/.dirs1;
    \mv ~/.dirs1 ~/.dirs;
}

alias U='source ~/.dirs'    # Update BOOKMARK stack
# set the bash option so that no '$' is required when using the above facility
shopt -s cdable_vars

Put this code in .bashrc in your home directory, then you are good to go.

use S to save a bookmark and cd (or G) to your favorite folder. try these commands you can how easy it is. here $ is your shell PS.

$ mkdir myfavfolder
$ cd myfavfolder
$ pwd
$ S fav
$ L
$ cd
$ pwd
$ cd fav
$ pwd

My work flow is to add a “now” bookmark to current work folder and move around to any folder and come back with cd now current folder. If I found I am accessing two folders frequently to finish the task at hand, I would bookmark them as now and then with addition to all other bookmarks. It works very well for me. what do you think.?

By the way., there is a great bash pulgin called bash_it on github. I added this functionality there as well.

Hosting guide to hcoop

NOTE: This guide is still very much incomplete.

This website is hosted at hcoop.net which is no-profit corporation and maintained by democratically elected community.

Getting membership

apply for membership by filling up the membership form. Remember the password displayed after submitting the form which will be useful to access your account.

Make new members payment

make a payment through paypal or google checkout from “new members payment page” and wait for payment to be processed. you will receive accepted email soon. once this process is done move on to setting up server which needs linux/unix familiarity. here I try to put the step by step as reference for myself and anyone who is starting setup. Infact there is very good wiki you should check out. This is guide mostly summary of that, agiain please remember not a completed one, if any problems you should consult the wiki.

Setup your hosting

Password less login

  • ssh to ssh.hcoop.net (with the above password., or ask for help from admins[at]hcoop.net)

  • change the password

  • I tried to add id rsa.pub ()

  • kerbeos client and kinit (token)

    • install from terminal
sudo apt-get install krb5-user libpam-krb5 libpam-ccreds auth-client-config

File system permissions (AFS).

My five steps.

  • give all permissions to .public

  • get all permissions for myself

  • give only read and list under web for public

  • take off all permissions to other users on the system
    • This may be needed to prevent fellow users on the system poke into your stuff
chmod 700 ~/*

be simple and trust me dont mess with them.

Main fs commands to note

  • grant permission to <USERNAME> to a directory DIR in your $HOME. Use
fs setacl -clear ~/DIR <USERNAME> all
fsr setacl -clear ~/DIR <USERNAME> all # r stands for recursive
  • give permissions to public for public html
fsr sa ~/public_html system:user read # listing and reading

Here is what I used exactly.

fsr sa ~ yagnesh all        #give myself every rule
fsr sa ~ system:anyuser l    # any user can list but cant read yet
fsr sa ~/web system:anyuser read # any user can read(lr) my webroot
chmod 700 *             # any other user cant poke into my Dir
fsr sa ~/.public system:anyuser all # .public for domtool access (I did not put any thing the)

Changing name servers of A domain from registrar (eg: godaddy)

  • hcoop.net nameservers
NS1.HCOOP.NET
NS2.HCOOP.NET
NS3.HCOOP.NET
  • hcoop.net IP since I read the user manual by skimming. I missed this one had to search for lot time.
69.90.123.68
  • whois lookup

Process domain domtool to get start (bit hairy)

Database creation

dbtool can be used to create new databases. First add username to mysql then create a DB

dbtool mysql adduser

Enter your login password dbtool creates useraccount in mysql. Then simply create a DB

dbtool mysql createdb test

Username test will be created for you.

Access databases

By the your databases are connected from host “mysql” not at “localhost”. From command line get into the mysql interactive session

mysql -p -h mysql DATABASE_NAME

Dropping tables

Droping tables are bit tricky. at first you are not give access to drop a DB or table with in a DB.

Pitfalls

Keep in mind that “your token may get expired”