February 2016

Run nginx in docker container

Docker can be used to run nginx in a container. We’ll use Ubuntu Linux (14.04.2) for the purpose of this tutorial. This tutorial assumes that read more

Chrome extension tutorial – access active page dom

This Chrome extension tutorial will cover building a basic hello world chrome extension where clicking on extension icon will open a popup window containing active read more

CSS ::before and ::after examples

CSS pseudo element ::before and ::after (CSS 2 syntax :before and :after) can be used to place some content before or after an element. Most read more

How to get docker container IP

Docker inspect can be used to get information including IP address about a container using its id or name. $ docker inspect [container_name_or_id] To get read more

Docker container – handy commands

Some handy command to work with containers. We’ll assume a docker image ubuntu is available on current machine. Run interactive shell (or any other command) read more

Linux – how to remove user from a group

To remove a user from a group on Linux, one can use gpasswd or deluser. Here are sample commands. Using gpasswd To remove user1 from read more

Docker how to add a user to group docker on Linux

It is a good idea to add a user to docker group. In case user is not added to docker group, you may see the read more

Docker quick start guide on Ubuntu

Docker is an open-source project that automates the deployment of applications inside software containers. Here is Docker quick start guide on Ubuntu Linux. We’ll use read more

How to resubmit robots.txt to Google

An error in robots.txt can cause Google to stop crawling a section of your site. In such case it is good to update and resubmit read more

Command line – top IP list from apache access log

Linux (or Unix) command line utilities like awk, sort, uniq, can be used to analyze apache log to get interesting stats. One use case is read more

Create gmail filter from search

In case you get lot of emails, its useful to create gmail filters to apply labels automatically and optionally archive matching emails. Gmail search can read more

Chrome extension tutorial – hello world

Chrome extension is very powerful feature of Chrome browser and an extension can be very useful for performing various activities on a web page. This read more

Chrome – how to access pre-release features

If you want to access pre-release features of Google Chrome, you can download Chrome Canary which is usually few versions ahead of stable Google Chrome. read more

Chrome – useful internal urls (chrome://)

Chrome has many useful internal page urls which begin with chrome://. One such example is chrome://settings. These are some handy internal command urls which can read more

View http headers in Chrome

Chrome developer tools can be used to view browser HTTP request and response headers when browser loads a page or makes AJAX calls. Here are read more

PHP – how to use function static variable as cache

PHP function static variable exists only in a local function scope but it does not lose its value after function execution. It can be used read more

Chrome extensions – how to enable developer mode

If you are building Chrome extensions and want to load extensions from directories, you need to enable Chrome developer mode for extensions. Here are quick read more

Bash – how to find last command exit status code

When writing bash scripts or running something on command line, last command exit code status is stored in environment variable $?. It can also be read more

Bash – how to redirect stderr to stdout or file

On Linux or Unix, error from a command (stderr) can be redirected to stdout or a file. These are the file descriptor id used on read more

PHP remove trailing whitespaces and newline

PHP has inbuilt function rtrim to remove specific or all trailing whitespaces from end of php string. preg_replace can also be used for this purpose. read more

PHP execute command and capture shell exit status

PHP exec and shell_exec can be used to execute a shell command on server side. exec also populates shell exit return status in one of read more

How to do grep without regex (fixed string)

Linux (or Unix) grep without any options does a regex grep on input stream. To disable regex either one can use grep -F or fgrep. read more

Python map examples

Python map is very useful built-in python function to achieve complex stuff over a list in very short and elegant way. Note that map applies read more

AngularJS controller basic clock example

Angularjs basic controller clock example to display date and update it every second. We’ll use controller, template and $timeout. We used AngularJS $timeout here. If read more

AngularJS simple controller tutorial to increment a value

Angularjs basic controller example to initialize a number in view, and then increment it on button click. We’ll use controller, template and ng-click directive. The read more

PHP regex – whitespace shorthand (\s) regex examples

PHP regex whitespace shorthand \s can be used to match whitespace characters. These are the characters it will match. Char Dec val Oct val tab read more

HTML5 shadow dom example

HTML5 shadow dom is part of Web components. It is currently in draft stage and supported by Chrome. It can also be compared with react read more