archivefeed

Google Chrome startup switches

startup switches runtime
-disable-dev-tools
-disable-hang-monitor
-disable-images
-disable-java
-disable-javascript
-disable-logging
-disable-metrics
-disable-metrics-reporting
-disable-plugins
-disable-popup-blocking
-disable-prompt-on-repost

about page url
about:memory
about:plugins
about:network
about:histograms
about:dns
about:cache
about:version
about:stats
about:crash

Source

Datestamped backup of git repositories managed by gitosis

#!/bin/bash

'''
A script to backup all the git repositories managed by gitosis
and create a date stamped tarball.

Pradeep Gowda
2011-08-19
'''

GITOSISADMIN=$HOME/mycompany/gitosis-admin
GITSERVER="git@gitserver.mycompany.com"
TODAY=`date +%Y-%m-%d`

mkdir gitbackups-$TODAY
grep ^writable $GITOSISADMIN/gitosis.conf | cut -d= -f 2 | tr "\\n" " " | tr " " "\\n"  | sort  | uniq | xargs -I {} git clone $GITSERVER:{}.git gitbackups/{}
tar czf gitbackups-$TODAY.tgz gitbackups

Updates on gist.github.com

A simple demonstration of emacs keyboard macros

you need to remember three keyboard shortcuts to use keyboard macros in emacs.

  • C-x ( – start-kbd-macro
  • C-x ) – stop-kbd-macro
  • C-x e – call-last-kbd-macro

Type, C-x ( hello C-x ) C-x e C-x e. You will have “hellohellohello”.

Let’s do something more useful like converting a list of words in to a HTML list of links. That is, given two words

        contact
     about

convert them into


<li><a href="/contact.html">contact</a></li>
<li><a href="/about.html">about</a></li>

Position the cursor in the first column of ‘contact’ and

C-x ( -- start recording
M-x just-one-space -- remove preceding white-space 
C-SPC -- set mark
C-e -- go to end of line 
M-w -- yank selected text 
C-a -- go the beginning of the line  and type <li><a href="/
C-y -- paste the text and type .html"></a></li>
C-a -- go back to column 0
C-n -- go to next line
C-x ) -- stop recording

To play back the record on subsequent lines, press C-x e as many number of times you want. To execute the macro n times, say 5, press C-u 5 C-x e.

Keep Honest

An objective method to monitor how much productive you truly are.

It is quite easy to get lost in the “social media” storm, even if the social media is technical and often relevant to the work. (eg:N, Reddit, Twitter etc.,). The cost of engaging in constant stream of information is that it is quite easy to get distracted.

The first step to get rid of a habit is to measure and assess it’s true impact.

One way to do this is to look back at your workscreen over the span of a day and see how much of it was spent in distractions.

We will be needing an application called scrot, which takes screenshots of the desktops from the shell.

Install scrot

$ sudo apt-get install scrot 

Create a directory to store the screenshots

$ mkdir ~/keephonest

Call scrot every minute and save the image to a folder.

$ crontab -e

Add the second line to the crontab

# m h  dom mon dow   command
* * * * * env DISPLAY=:0 /usr/bin/scrot /home/USERNAME/keephonest/screen\%F-\%T.png > /dev/null

Let crontab+scrot record your screen for an entire day. Play the screenshots using a GUI application (eg: Eye of Gnome – eog) to see where most of your time was spent.

Configuring nginx + couchdb to deploy a couchapp as a public facing website.

Three things to remember while configuring a couchapp to run as a web facing application. Below, I document the steps I took to deploy the example pages app from couchapp.org.

  1. set the vhost in /etc/couchdb/local.ini.
    [vhosts]
    home.btbytes.com = /pages/_design/pages/_rewrite
  1. add vhosts entry to couchdb by visiting configuration page in futon app and adding a new section:
    section = vhosts
    option = home.btbytes.com
    value = /pages/_design/pages/_rewrite
  1. configure nginx to proxy the requests to / to the port running couchdb. See ref
    location / {
        proxy_pass http://localhost:5984;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

Securing the web app with SSL.

Primary reference for securing the above installation with SSL certificates is :

I followed the instructions verbatim with success.

Tests

  • Use curl client to access https + basic_auth enabled site.

    curl https://user:password@home.btbytes.com/page/index –cacert /etc/ssl/certs/home.btbytes.com.crt

This returned the page contents as expected.