Skip to content

Instantly share code, notes, and snippets.

View vnykmshr's full-sized avatar

Vinayak Mishra vnykmshr

View GitHub Profile
@vnykmshr
vnykmshr / robots.txt
Created October 18, 2013 22:31
Who exactly is crawling your site? Find out more - http://danbirken.com/seo/2013/10/17/who-exactly-is-crawling-my-site.html. Adding author's robots.txt here for reference.
User-Agent: Googlebot
Allow: /
User-Agent: Googlebot-Mobile
Allow: /
User-Agent: msnbot
Allow: /
User-Agent: bingbot
@vnykmshr
vnykmshr / install-nagios-client.sh
Created October 15, 2013 11:28
Download and Install Nagios client plugin along with NRPE plugin. This script is written for a Ubuntu server but you can easily modify it to suit your needs. Post installation, modify `/etc/xinetd.d/nrpe` to restrict request origin, update `/etc/services` to add `nrpe` service.
#!/bin/bash
# Nagios client install script
# Vinayak Mishra <[email protected]>
set -e -x
# ensure only root can run the script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
@vnykmshr
vnykmshr / email-check.js
Last active December 25, 2015 14:09
Simple Email Validations
/**
* Simple email validation
* ensures at least one `@` sign, at least one char in local part,
* at least one `.` in domain part and is at least one char long
*/
isEmail: function (em) {
em = em || '';
var indx = em.lastIndexOf('@');
return indx > 0 && (em.lastIndexOf('.') > indx) && (em.length - indx > 1);
}
@vnykmshr
vnykmshr / install-node.sh
Created September 30, 2013 11:09
Installs node.js from source. Also installs missing libraries needed to run node.js. Update node version to latest stable release.
#!/bin/sh
## Install pre-requisites
sudo apt-get install -y git-core build-essential openssl libssl-dev pkg-config
## Ensure python <3 is available
ret=`python -c 'import sys; print("%i" % (sys.hexversion<0x03000000))'`
if [ $ret -eq 0 ]; then
echo "we require python version <3"
mkdir /tmp/bin; ln -s /usr/bin/python2.7 /tmp/bin/python;