Skip to content

Instantly share code, notes, and snippets.

View mushfiq's full-sized avatar

Mushfiq mushfiq

View GitHub Profile
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):
@mushfiq
mushfiq / fabfile.py
Last active December 14, 2015 15:09
Fabric boiler plate for deployment.
from fabric.api import local, run, env, put
env.graceful = False
def test_server():
env.user = 'your_user_name'
env.serverpath = '/'
env.site_root = 'your_app_root'
env.password = 'your_pass' #ssh password for user
# env.key_filename = ''# specify server public key
#lis of hossts in env.hosts
@mushfiq
mushfiq / Jquery_example.js
Last active December 17, 2015 08:29
Sample Js file
(function ($) {
app = {}
app.globalSetting = {
url : {
'local': Drupal.settings.ajaxify.baseUrl
},
noAjaxUrl :[
'blogs',
@mushfiq
mushfiq / requirements.txt
Last active December 19, 2015 10:28
Vote update
BeautifulSoup==3.2.0
requests==0.9.1
from itertools import chain
cars = Cars.objects.all()
trucks = Truck.objects.all()
all_vechiles = list(chain(cars, trucks))
class Ladder(object):
def __init__(self):
self.hight = 20
class Table(object):
def __init__(self):
self.legs = 4
my_factory = {
"target1": Ladder,
class Train(object):
def __init__(self):
self.speed = 120
class Bus(object):
def __init__(self):
self.speed = 60
class Trum(object):
def __init__(self):
#!/bin/sh
MONGODB_SHELL='mongo'
DUMP_UTILITY='mongodump'
#SET the bd name which one you want to backup
DB_NAME=''
#SET server path where you want to save the file
CLOUD_PATH=''
function freeze_db() {
rc = db.runCommand({fsync: 1, lock: 1});
if (rc.ok == 1){
return 1;
} else {
return 0;
}
}
freeze_db();