This file contains hidden or 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 pymongo import MongoClient | |
# create a MongoDB client | |
client = MongoClient('localhost', 27017) | |
series_db = client['SeriesDB'] | |
series_collection = series_db['series'] | |
def insert_document(collection, data): |
This file contains hidden or 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
#!/usr/bin/env python3 | |
class SimpleCalculator: | |
def sum(self, a, b): | |
""" Function to add two integers """ | |
if isinstance(a, int) and isinstance(b, int): | |
return a + b | |
else: | |
return "ERROR" |
This file contains hidden or 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
def check_order(str): | |
""" | |
This function checks whether the letters in an alphabet | |
are sorted alphabetically and returns True. | |
Otherwise it returns False | |
""" | |
if ''.join(sorted(list(str))) == str: | |
return True | |
else: | |
return False |
This file contains hidden or 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
"Vundle setup instructions - https://github.com/VundleVim/Vundle.vim | |
"Pathogen setup instructions - https://github.com/tpope/vim-pathogen | |
":PluginInstall | |
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
set expandtab | |
set tabstop=4 |
This file contains hidden or 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
# local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" | |
# PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' | |
function virtualenv_info { | |
[ $VIRTUAL_ENV ] && | |
echo '('%F{blue}`basename $VIRTUAL_ENV`%f') ' | |
} | |
#use extended color palette if available | |
if [[ $terminfo[colors] -ge 256 ]]; then |
This file contains hidden or 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 gs='git status ' | |
alias ga='git add ' | |
alias gb='git branch ' | |
alias gco='git checkout ' | |
alias gcob='git checkout -b ' | |
alias gcot='git checkout -t ' | |
alias gc='git commit ' | |
alias gl='git pull ' | |
alias gf='git fetch ' | |
alias gp='git push ' |
This file contains hidden or 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
def sum_even(a): | |
sum = 0 | |
for num in a: | |
if num%2 == 0: | |
sum+=num | |
return sum | |
def super_sum(a): | |
sum = 0 | |
for num in a: |