Skip to content

Instantly share code, notes, and snippets.

View mushfiq's full-sized avatar

Mushfiq mushfiq

View GitHub Profile
@mushfiq
mushfiq / squid.conf
Created November 16, 2011 10:08
Squid minimum configuration
# ----------------------------------------------------------------------
# WARNING - do not edit this template unless you know what you are doing
# ----------------------------------------------------------------------
# the parent cache
# disk and memory cache settings
cache_dir ufs /usr/local/squid/var/cache 500 16 256 #set your cache path with size
@mushfiq
mushfiq / movie_info.py
Created February 26, 2012 19:22
IMDB Movie Info CRAWLER
import re
import requests
import urllib
import json
# MOVIE_NAME = 'The Other Dream Team'
BASE_URL = 'http://www.imdbapi.com/?'
NAME_LIST = file('movies.txt','r')
@mushfiq
mushfiq / Demo_google_crawl.py
Created June 16, 2012 05:54
Sample google crawler
'''A sample google search script,you have to install python module "google before running it"'''
import sys
import time
from google import search
def do(keyword,stop):
count = 0
for url in search(keyword,lang='en',num=10,pause=3):
count +=1
print url
@mushfiq
mushfiq / javascript_design_pattern.js
Created September 25, 2012 04:59
Javascript pattern
app = {};
app.run = function run() {
//console.log('Running app...');
app.init();
}
app.init = function () {
//console.log('Running init...');
app.bind();
}
@mushfiq
mushfiq / js_url_based_design_pattern.js
Created September 25, 2012 05:37
Javascript url based pattern
var app = this.app || {};
// Application Settings
app.settings = {
'ajax' : {
'timeout' : 50000,
'delay' : 0
}
}
@mushfiq
mushfiq / Use Python Getter Setter.py
Last active October 13, 2015 17:37
Python Class Properties using decorators
class Book(object):
@property
def title(self):
return self._title
@title.setter
def title(self, value):
if value is None or "" == value.strip():
raise ValueError("Title should have proper value!")
from itertools import izip
A = [1, 2]
B = [3, 4]
C = [5, 6]
def iterate_using_zip(item1, item2, item3):
for a,b,c in zip(item1, item2, item3):
print a,b,c
@mushfiq
mushfiq / .vimrc
Created February 1, 2013 12:53
My .vimrc configuration which is bare bone configuration for any kind of .vim power use :)
set nocompatible
set number
set title
syntax on
set hlsearch
set ls=2
set showmode
alias p=pwd
alias l='ls -l'
alias webroot='cd /Library/WebServer/Documents'
alias php.ini='vim /private/etc/php.ini'
alias httpd.conf='sudo vim /etc/apache2/extra/httpd-vhosts.conf'
alias hosts='sudo vim /etc/hosts'
alias mongo-server='/Library/mongodb-osx-x86_64-1.8.1/bin/mongod'
alias mongo-client='/Library/mongodb-osx-x86_64-1.8.1/bin/mongo'
alias down='sudo halt'
alias apache='sudo /usr/sbin/apachectl restart'
from __future__ import division
from math import sqrt, pow
class StandardDeviation(object):
def do_round(self, data):
data = "%.3f" % round(data, 3)
return float(data)
def do_diff(self, n, mean):