This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
app = {} | |
app.globalSetting = { | |
url : { | |
'local': Drupal.settings.ajaxify.baseUrl | |
}, | |
noAjaxUrl :[ | |
'blogs', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BeautifulSoup==3.2.0 | |
requests==0.9.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import chain | |
cars = Cars.objects.all() | |
trucks = Truck.objects.all() | |
all_vechiles = list(chain(cars, trucks)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ladder(object): | |
def __init__(self): | |
self.hight = 20 | |
class Table(object): | |
def __init__(self): | |
self.legs = 4 | |
my_factory = { | |
"target1": Ladder, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Train(object): | |
def __init__(self): | |
self.speed = 120 | |
class Bus(object): | |
def __init__(self): | |
self.speed = 60 | |
class Trum(object): | |
def __init__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function freeze_db() { | |
rc = db.runCommand({fsync: 1, lock: 1}); | |
if (rc.ok == 1){ | |
return 1; | |
} else { | |
return 0; | |
} | |
} | |
freeze_db(); |