Yagnesh http://yagnesh.org/ Just another regular guy en-us Tue, 15 Sep 2020 00:00:00 +0530 http://yagnesh.org/2020/09/15/cdo_calculate_wind_speed_from_u_v_rst.html http://yagnesh.org/2020/09/15/cdo_calculate_wind_speed_from_u_v_rst.html <![CDATA[CDO calculate wind speed from U,V]]> CDO calculate wind speed from U,V

Climate Data Operators (CDO) is a powerful software for climate data analysis. It can perform numerous operations on climate data sets. The following example lets you calculate wind speed from u, v components. uv.nc is the input data set which contains of u and v wind components. output wind speed will be written in ws.nc.

cdo chname,u,ws -sqrt -add -sqr -selname,u uv.nc -sqr -selname,v  uv.nc ws.nc
]]>
Tue, 15 Sep 2020 00:00:00 +0530
http://yagnesh.org/2016/10/20/modati_maata.html http://yagnesh.org/2016/10/20/modati_maata.html <![CDATA[మొదటిమాట]]> మొదటిమాట

తేట తేట తెలుగులా.. తెల్లవారి వెలుగులా..

చాలా రోజుల నుండి నా ఈ బ్లాగులో కొన్ని తెలుగు వ్యాఖ్యానాలు కూడా చెర్చాలి అని అనుకుంటూ ఉన్నాను. ఇన్నాళ్ళకు సమయం కుదిరింది, లేదు వొంటి బద్దకం తగ్గింది. ఒక ఇబ్బంది ఏంటంటే తెలుగులో టైపింగు నాకు సరిగా రాదు. రేండోది మనకు తెలుగు సరిగా రాదు :/. సరేలె ఇంగ్లీషులో సామెత చెప్పినట్లు (better late than never.) మొదలు పెట్టుట ముఖ్యం. మన సాంప్రదాయం ప్రకారం మనస్సులో విఘ్నెశ్వర స్మరణతో ప్రారంభం చేస్తున్నాను.

NOTE: If this post is not displaying properly, that means your system lacks fonts for Telugu script. Please install Telugu fonts.

]]>
Thu, 20 Oct 2016 00:00:00 +0530
http://yagnesh.org/2016/09/20/joined_iitm.html http://yagnesh.org/2016/09/20/joined_iitm.html <![CDATA[Joined IITM]]> Joined IITM

After long holidays and roaming around India I have finally joined a day job at Indian Institute of Tropical Meteorology(IITM), Pune. Its been almost three weeks here in Pune, The Institute and IITM colony are great. Beautiful location and Beautiful people all around.

Hopefully from now on-wards I may blog regularly about work and my workouts.

]]>
Tue, 20 Sep 2016 00:00:00 +0530
http://yagnesh.org/2015/05/05/ncl_mode_for_emacs.html http://yagnesh.org/2015/05/05/ncl_mode_for_emacs.html <![CDATA[ncl-mode for Emacs!]]> ncl-mode for Emacs!

ncl-mode is a Emacs major mode for editing ncl scripts. The project also also consists several useful features to assist writing ncl scripts. I have used this mode long enough to recommend to anyone who writes ncl scripts with in Emacs. The major features of this packages consists (from the readme:)

  • Easy code navigation (consistent with other Emacs modes)

  • Better indentation

  • Proper comment handling

  • Imenu support (my favorite)

  • Menu support

  • Snippets for yasnippet

  • auto-complete support

  • ctags support (ctags generation script included)

  • ncl-doc-mode minor mode for browsing/searching NCL documentation from NCAR website

  • inf-ncl.el mode for running NCL within Emacs.

ncl-mode can be easily installed from either MELPA or el-get package managers. Feel free to try and open an issue on github for any feature request.

]]>
Tue, 05 May 2015 00:00:00 +0530
http://yagnesh.org/2015/05/05/finally.html http://yagnesh.org/2015/05/05/finally.html <![CDATA[Finally I have graduated from Hokudai.]]> Finally I have graduated from Hokudai.

Finally I managed to finish my PhD. I wasn’t totally satisfied, nevertheless happy that I am getting the degree. Now, I can have prefix to my name if I want to.

I may put my thesis online some time soon and also I wish to write some long never ending post about my PhD life.

]]>
Tue, 05 May 2015 00:00:00 +0530
http://yagnesh.org/2015/02/21/china_india_tibet_arunachal_pradesh.html http://yagnesh.org/2015/02/21/china_india_tibet_arunachal_pradesh.html <![CDATA[China, India, Tibet, Arunachal Pradesh]]>

China, India, Tibet, Arunachal Pradesh

Yesterday Prime minister Modi visited Arunachal Pradesh to inaugurate its first ever railway link. Within hours, Chinese government protested by saying “India should pay attention to the strong concern of the Chinese Side”. To begin with, Its ridiculous to think that Chinese government even has a concern about an Indian prime minister visiting to its own Indian State.

../../../_images/modi_arunachal.png

Chinese have long tradition to rake up the boarder issues with its neighbors to keep a check on them. Chinese should first introspect about their involvement in Tibet before voicing concerns about other countries. Not long ago in 2008, Chinese had an embarrassment with all over the world when Olympic torch baton relay took place. Even their state owned media could not keep mum about strong protests by young Tibetans against Chinese illegal occupation of Tibet.

The unfortunate leadership of early leadership of Indian independent India allowed China to become a neighbor. Fact is, Historically China was never been a neighbor to India before it illegally occupied Tibet in 1951. The Chinese gripe about India is that it is sheltering Central Tibetan Administration (CTA) leader Dailai Lama in India. It wants to put pressure on India by raking up with boarder disputes. Whenever any discomfort with Indian government there will be incursions in the Ladakh region to bully and bring India to a negotiation table. This has been going too far now, but China will soon slowly take notice of the power shift in Delhi and will behave better in the years to come.

Modi is well aware of the issues with China, for now he would totally concentrate on Indian economic growth and modernization of Indian military and rightly so. The process has begun already, India started aggressively spend on three branches of the military. Progress in total Indigenous defense manufacturing on its way. On the diplomatic front India will strongly lobby for permanent membership of the United Nations Security Council (UNSC). Now that, all the five veto powered nations principally, at least verbally, agreed to Indian state induction to UNSC, Modi will pursue on that with continuous effort. Modi should be as proactive as he was with the International Yoga Day announcement by UN. It may not be easy but becoming a permanent member is just a eventuality because of India’s sheer size in both population and economy.

Meanwhile India can play low key fight with India voicing for Tibet’s Independence. The previous Indian establishments are too timid to talk about Tibet. Modi doesn’t belong to that list but I believe he is waiting to set his own house right first before showing eye to eye to the Chinese. This is/should also be an eventuality.

]]>
Sat, 21 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/02/19/wrf_install_helper_scripts_to_build_wrf_model.html http://yagnesh.org/2015/02/19/wrf_install_helper_scripts_to_build_wrf_model.html <![CDATA[wrf_install: Helper scripts to build WRF model (v0.7 release)]]> wrf_install: Helper scripts to build WRF model (v0.7 release)

wrf_instll is a small project consists of a bunch of shell scripts which I use for building WRF model. WRF is large enough to have many dependencies such as NETCDF, HDF5, zlib and so on. This wrf_install scripts are very handy, at least for me, saves a lot of time and headache.

I just now released v0.7 with a lot of improvements. This is a point release as I thought the last release was almost two years ago and let me push out some tag for now. There are some significant changes in the way the scripts run. Now the building process is much more sensitive to the errors and gives lot of feed back. I also improved README file significantly, as I was writing README earlier I found that how bizarre state it was in. I don’t say Its super good now, I believe its at least readable.

Even though this is a tiny project, it gives me immense pleasure once in a while when a young and enthusiastic meteorologist sends me mails and ask questions about how to use the scripts and build WRF model. Even though, I must say, they often come up very basic problems. But hey, everybody starts from zero, right?

If any of used it and find problems or suggestions please let me know by commenting here or github issue page.

Happy Predicting :)

]]>
Thu, 19 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/02/19/restoration_of_sapporoindians_site.html http://yagnesh.org/2015/02/19/restoration_of_sapporoindians_site.html <![CDATA[Restoration of sapporoindians site.]]> Restoration of sapporoindians site.

Few years ago, I created a website for Indian Association Sapporo (or IAS as we call it). I think most of our community members don’t even bother to look at it. It is mainly indented to help those Indians who are planning to come to Sapporo.

This website is a simple wordpress site with less than 5 pages. But Last year, I noticed it has a security flaw which had been exploited by a spammer. This scammer sending mass spam mails by using wp plugin folder to which I had mistakenly gave write access. I admit that It was dumb mistake. Luckily I noticed that very early as I traced bouncing mails for the spam that is being sent out. I had simply disabled whole site without fixing the problem. I was busy breifly at that time and hadn’t been motivated enough to devote time to that not so important work. Frankly not a single sole complained about it and It dragged on.

Anyway, after a long delay, yesterday, I took a stab at it and finished the restoration work of the site. On the way I upgraded wordpress from 3.5 to 4.1.

How did I fix it, it was just setting up proper access controls to wp-content folder. The site is hosted at hcoop which uses afs file system. Hcoop wiki has very nice article on how to setup wordpress blog properly and details about access controls. I just used those instructions.

The site seems to work beautifully now.

]]>
Thu, 19 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/02/19/elisp_wrapper_for_tinkerer.html http://yagnesh.org/2015/02/19/elisp_wrapper_for_tinkerer.html <![CDATA[Elisp wrapper for Tinkerer]]> Elisp wrapper for Tinkerer

I just finished writing a tiny Elisp package to help myself writing this blog. Its a wrapper for tinkerer blogging engine. Its called unsurprisingly tinkerer.el. It still needs some polishing. But its in working shape, in fact, this blog post is written by using the that package.

As I use it more and more I will improve progressively. This should be handy for Emacs tinkerers if there are any out in the wild. Right now, It can be installed from el-get package manager (if you use el-get, just do M-x el-get-install RET tinkerer RET). I will add it MELPA soon.

]]>
Thu, 19 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/02/14/the_unusual_suspects_in_this_world_cup_2015.html http://yagnesh.org/2015/02/14/the_unusual_suspects_in_this_world_cup_2015.html <![CDATA[The Unusual Suspects of Cricket World Cup 2015]]>

The Unusual Suspects of Cricket World Cup 2015

In my last post I discussed the possible winners of the World Cup 2015. Now I try to predict the possible high impact players of this world cup. I think most of cricket fans have an idea about the star players who would make an strong impact in this world cup, i.e., likes of AB de-Villiers, Virat Kohli, Hashim Amla, Steven Smith, Kane Williamson, David Warner etc. But I like to guess those who are not in the radar, but will have real impact in this time. Here is my list of The Unusual Suspects:

../../../_images/2015_Cricket_World_Cup_Logo.svg
  • George Bailey: Nice and Gritty Bailey, though captaining Australia, still uncertain of his place in the team. I expect him to do a lot better than the most of Aussie players.

  • JP Duminy: JP is really low key in South Africa team is really good player. He will be the man who will have high impact in both bat and bowl departments.

  • David Miller: Even though SA top order looks solid, David Miller will become savior when top order batsman fall cheaply.

  • Shehzad Ahmad: Pakistanis always bring new faces, so its tough to predict names. But from what I have seen little of Shehzad, I expect him to shine this time around.

  • Suresh Raina: He made to this list because I am big fan of him. I really believe he is better player than the statistics on his back. If he tries to play little cautiously and maintain slow pace than he is capable of he would surprise many this time.

  • Mitchel Starc: Even though Mitchel Johnson is lead bowler I expect Starc to be most wicket taker for Australia. I predict because Starc looked very passionate to perform.

  • Guptil: He is good player than his recent form says.

  • Andre Russels: He is just better player in the WI cricket team. Since he bats in the lower order, so far he hasn’t been able to make much impact but I expect him to do well in this world cup.

I am not much familiar with the Associate members’ teams of ICC. So I couldn’t list their names. If you have any name that should be in this list please inform me in the comments.

On a final note is, to my own surprise, no English player made into my list. I searched through the English team, but nobody sparked to my eye. Hopefully English players will prove me wrong at the end of the world cup.

]]>
Sat, 14 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/02/14/cricket_world_cup_2015_indian_prospective.html http://yagnesh.org/2015/02/14/cricket_world_cup_2015_indian_prospective.html <![CDATA[Cricket World Cup 2015]]>

Cricket World Cup 2015

../../../_images/2015_Cricket_World_Cup_Logo.svg

Cricket world cup 2015 kicked off today. I was introduced the game of cricket when I was 11 during 1996 world cup. I loved watching cricket and occasionally playing it. I will reserve my experiences and memories for another post. The exciting question today is that who will the world cup or who has better chance of winning the cup this year. I safely bet only one of these four teams have an chance of winning the cup: Australia, New Zealand, South Africa and India. I listed the order with their winning probability. Mind you my prediction of any thing is as good as my prediction of weather as a researcher.

Australia:

Australia have real chances purely by looking at the quality of the side. Second important factor is that they are playing in their own backyard. Australians have a strong bowling line up lead by Michel Johnson and the batting line with likes of Warner, Bailey, Maxwell and in form Steve Smith. I would say they have almost 80% of chance of bagging their fifth world cup.

New Zealand:

New Zealand team is full of confidence right now with its recent form. One of the major advantages is that they are playing all the league (up to semi finals if they reach there) matches in New Zealand. They have good if not great batting line up and also couple of all rounder like Corey Anderson, Luke Ranchi. Personally I am backing up New Zealanders to win this world cup.

South Africa:

As always with every world cup, South African are one of the favorites this time again. Would they win the cup this time? well, I say they have very bright chances, especially because of their batting line up is on par with ever green bowling line up. I wish they will remove the tag of Chokers after this world cup by winning it.

India:

India is on my list only because the rest of the teams are far worse and my own bias them as Indian. India’s bowling is just rubbish, the less we talk about it is the better. They have fair chances because of their strong batting line up. One thing I would point I noticed at least among the fans the appetite to win the cup. I was speaking to some of the friends, Its okay if we don't win this cup, since we already won the last one. May be its just Indian mentality and I hope that’s not the cricketers are thinking.

Hope world cup to be fun watching and the best team get to lift the cup. Have a look at my list of unusual suspects of this world cup.

]]>
Sat, 14 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/02/11/aam_aadmi_party_online_propaganda_tricks_used_in_the_assembly_elections_2015.html http://yagnesh.org/2015/02/11/aam_aadmi_party_online_propaganda_tricks_used_in_the_assembly_elections_2015.html <![CDATA[Aam Aadmi Party online propaganda tricks used in the Assembly Elections 2015]]>

Aam Aadmi Party online propaganda tricks used in the Assembly Elections 2015

Aam Aadmi Party (AAP) won the 2015 assembly elections with resounding mandate. I looked into some of the reasons that helped to achieve this spectacular win and its implications. There is also another factor which I haven’t touched in that post, i.e, their clever online campaign.

They outsmarted Bharatiya Janata Party (BJP) easily and created lot of positive perception among the young voters. I will try to sum up what are things they have done or at least I have noticed them doing and what BJP and others should learn from this online campaign.

  1. Twitter: AAP continuously able to make their hashtags trend on top. This is very important because India’s total politics played on twitter these days. Most of the Indian politicians and journalists sits on twitter all day along to gauge the news and mood of the campaign. AAP has created and placed bots and excellent graphics on the twitter stream to shine their voice. If you can imagine the details, this doesn’t cost much money and few systems with proxies setup can automate all this work.

../../../_images/akvsmukhi.jpg
  1. Graphics: I am guessing AAP has good designers continuously made very huge number of propaganda graphics. I don’t even need to go into details of why good graphics are essential for a political campaign. Their excellent graphics are continuously trended all over twitter India. I can safely bet, after looking at many of their works, that the number of graphic designers worked on this task not more than three. Let me give one example to illustrate how smart AAP designers are. Look at the picture they printed all over Delhi at very beginning of their campaign. A happy faced Arvind Kejriwal vs moody face Jagadeesh Mukhi. A very subtle, unnoticeable way of putting AK is the best choice. Its I consider hitting below the belt but hey who stopped BJP in doing that.

  2. disqus comments: All popular news sites use disqus for their comments. disqus comments displayed sorted by votes given to that comment. Unfortunately votes can be easily manipulated. AAP used some javascript code to automatically bump votes up for their comments to bring them on to the top. If you see all popular news sites, top comments will be filled up with AAP propaganda. This is very very cheap and huge impact on ordinary readers of the news sites.

  3. whatsapp/email: Chain emails, whatsapp forwards were also huge. They have created a huge database of email ids and then bombarded propaganda messages to those mails, same with whatsapp and phone numbers.

  4. mobile app: This has minor impact but yet again this shows their intensity of reaching out targeted audience.

In conclusion AAP played well their game in beating BJP or any other in this area. A group of more or less 10 people would have worked for all this very effectively. I think BJP should start embrace some tecno-saavy volunteers to step up their game. Otherwise as India progresses towards more internet penetration, BJP will face lot of difficulties in fighting AAP’s online game.

]]>
Wed, 11 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/02/11/aap_win_what_does_it_mean_for_indian_politics.html http://yagnesh.org/2015/02/11/aap_win_what_does_it_mean_for_indian_politics.html <![CDATA[AAP win, what does it mean for Indian Politics?]]>

AAP win, what does it mean for Indian Politics?

../../../_images/aap.jpg

Yesterday Aam Aadmi Party (AAP) lead by Arvind Kejriwal (AK) won spectacular win in Delhi assembly elections by winning 67 seats out of 70. The victory of this scale and beyond (Winning 95.7% of seats) is only happened in the tiny state of Sikkim. Sikkim Sangram Parishad (SSP)and Sikkim Democratic Front(SDF) held all 32 seats in 1989 and 2009 respectively.

AAP worked hard to create a positive perception especially among youth. They reached out campaign larger number of youth population than any other party with their spectacular . They offered/promised free Wi-Fi to the youth. They posed as real aam aadmi and reached out to the slum dwellers and generous free poll offerings such as free water and cheap electricity. They also got whole sale support of Muslim and Christian community just to oppose BJP’s victory. AAP also played their fair share of communal, racial, caste and regional politics in the background.

They also had all political parties’ support just to oppose further rising of BJP after their general election win. Interesting part is, both Mamatha of TMC and Left parties which fight each other in West Bengal given their support to AAP just to stop BJP and its winning streak of acquiring more and more states in their fold.

Media played crucial part in making things worst for BJP. Media’s grudge against Central Government shown all the way. They blatantly given one sided support to AAP. I think among all of the reasons, Delhi voters really wanted to test the new party to see how would they go about and thought lets us give a chance to these guys..

So AAP won, its history now. what are the positive and negatives to take away. The positive thing is AAP won the election on Anti Corruption and Clean Election Funding plank. Whether or not AAP maintains those stands (To be fair to them, they were more transparent than others) the politics in India changed in such a way that every political party would need to become more transparent and less corrupt. This is a really good sign for Indian democracy. Another thing I liked about them is they brought many young people into the active politics which is healthy for India where general perception is all politicians are corrupt. Hopefully that will change to some extent.

Not everything is shiny with AAP, there are some concerning things about this win. AAP and Arvind Kejriwal lied with their teeth on some of things, there are some shady funding allegations which were never answered, but worst of all their far left ideology. Their give it for free based approach has very bad economical repercussions especially when India is strongly looking to advance its economy to a greater heights. Anyhow, I or anyone don’t need to be skeptical without giving proper time to Arvind Kejriwal and his team. So I will wait and watch keenly their actions before shouting to the roof.

Finally I will close by saying Good Luck to AAP/AK and real aam aadmi of Delhi.

]]>
Wed, 11 Feb 2015 00:00:00 +0530
http://yagnesh.org/2015/01/21/timer_revert_mode.html http://yagnesh.org/2015/01/21/timer_revert_mode.html <![CDATA[Emacs minor mode timer-revert-mode]]> Emacs minor mode timer-revert-mode

Yesterday instead of writing thesis I was wasting time to write a small minor mode. Fortunately it came good and I put it on github. timer-revert-mode reverts a buffer when its associated files modifies in the background. Yes, there is auto-revert-mode for that. But auto-revert-mode was causing more problems than it solve for my use case.

The commentary from the timer-revert-mode package reveals what it does.:

A minor mode to revert buffer for a given time interval.

This is more like `auto-revert-mode' but with a specified time interval.
see `timer-revert-delay', defaults to 15 seconds.  This is useful because
Emacs' auto-revert-mode doesn't have a facility to tell the frequency.

My use case is while writing latex documents, background running make
needs some time to finish, usually 5 to 10 seconds.  unlike
`auto-revert-mode' which is very eager to load the file as soon as its
modified outside, this one lazily waits for 15 seconds.  For best
experience, if the background process takes 5 seconds then
`timer-revert-delay' should be around 10 seconds.  Okay the logic is not
perfect though but minimizes conflicts.
]]>
Wed, 21 Jan 2015 00:00:00 +0530
http://yagnesh.org/2014/09/24/new_blog_setup.html http://yagnesh.org/2014/09/24/new_blog_setup.html <![CDATA[New blog setup with tinkerer.]]> New blog setup with tinkerer.

I finished migrating this site to tinkerer blog engine from o-blog in the last weekend. With o-blog 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 the site became painfully slow to load the pages because of heavy use of Javascript which is against the 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? well I have some familiarity with python and I liked the idea of Tinkerer is being just tiny layer on the 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 and fixing.

One of the main reason for the migration is I want to write more and o-blog was putting me off with its above mentioned problems. I want to reduce any unsolicited friction that hinders me to write.

]]>
Wed, 24 Sep 2014 00:00:00 +0530
http://yagnesh.org/2013/02/03/for_the_sake_of.html http://yagnesh.org/2013/02/03/for_the_sake_of.html <![CDATA[For the sake of!!!]]> 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.?

]]>
Sun, 03 Feb 2013 00:00:00 +0530
http://yagnesh.org/2013/01/20/just_one_space.html http://yagnesh.org/2013/01/20/just_one_space.html <![CDATA[Emacs Tip: just-one-space]]> 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.

]]>
Sun, 20 Jan 2013 00:00:00 +0530
http://yagnesh.org/2011/08/09/bash_navigation.html http://yagnesh.org/2011/08/09/bash_navigation.html <![CDATA[Bash navigation is made easy.]]> 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.

]]>
Tue, 09 Aug 2011 00:00:00 +0530
http://yagnesh.org/2011/07/06/hcoop_guide.html http://yagnesh.org/2011/07/06/hcoop_guide.html <![CDATA[Hosting guide to hcoop]]> 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”

]]>
Wed, 06 Jul 2011 00:00:00 +0530