Skip to content

Instantly share code, notes, and snippets.

View mushfiq's full-sized avatar

Mushfiq mushfiq

View GitHub Profile
@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();
db.$cmd.sys.unlock.findOne();
@mushfiq
mushfiq / crawlPyCentral.py
Last active December 20, 2015 21:29
An example of using super in python
import requests
from BeautifulSoup import BeautifulSoup
class crawlPyCentral(object):
def __init__(self, url='http://pythoncentral.org/'):
self.url = url
def getSoup(self):
response = requests.get(self.url)