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
#Python code | |
import base64 | |
json_body = json.loads(request.body) | |
my_file = json_body.get('imageInput') | |
my_filename = "akash_image.JPG" | |
imgdata = base64.b64decode(my_file) | |
saved_file = "akash_image.JPG" | |
with storage.open(saved_file, 'wb+') as destination: | |
destination.write(imgdata) |
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
*:80 is a NameVirtualHost | |
default server ip-something.us-west-2.compute.internal (/etc/apache2/sites-enabled/000-default:1) | |
port 80 namevhost ip-something.us-west-2.compute.internal (/etc/apache2/sites-enabled/000-default:1) | |
port 80 namevhost www.something-west-2.compute.amazonaws.com/url1 (/etc/apache2/sites-enabled/DOMAIN:3) | |
port 80 namevhost www.something.compute.amazonaws.com/url2 (/etc/apache2/sites-enabled/DOMAIN:28) | |
Syntax OK |
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
NameVirtualHost *:80 | |
<VirtualHost *:80> | |
ServerName www.DOMAIN.com/url1 | |
ServerAlias DOMAIN.com/url1 | |
ServerAlias *.DOMAIN.com/url1 | |
DocumentRoot /home/ubuntu/url1 | |
Alias /robots.txt "/home/ubuntu/url1/public/robots.txt" |
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
#Templates | |
<input type="file" class="btn btn-default" id="dish_file" name="dish_file"> | |
#Views | |
def some_view(request): | |
# some check over here | |
# the following code is to copy the uploaded file but these doesnt seem to be working | |
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
import multiprocessing | |
def worker(num): | |
"""thread worker function""" | |
print 'Worker:', num | |
return num | |
if __name__ == '__main__': | |
jobs = [] | |
for i in range(5): |
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
# Views | |
import logging | |
logger = logging.getLogger(__name__) | |
# Settings | |
LOGGING = { | |
'version': 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
import unittest | |
def check_in_range(a): | |
if a>=0 and a<5: | |
return True | |
else: | |
return False | |
def find_matrix(blocker): | |
a = [[1,0,1,1,1],[1,0,0,0,1],[1,0,0,0,1],[1,0,0,0,1],[1,1,1,0,1]] | |
if not blocker: |
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
<!doctype html> | |
<html ng-app="project" ng-init="users=["mahesh", "hari"];;"> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-resource.min.js"> | |
</script> | |
</head> | |
<body> | |
<div > |
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
Installation : easy_install alembic or pip install alembic | |
Changing the dialect of database in alembic.ini to your own local database | |
In alembic folder change the env.py folder's settings as | |
from myapp.models import Base | |
target_metadata = Base.metadata | |
Now run command : alembic upgrade head |
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
users_tags_table = Table('users_tags', Base.metadata, | |
Column('users_id', Integer, ForeignKey('users.id')), | |
Column('tags_id', Integer, ForeignKey('tags.id')) | |
) | |
users_tags_table = Table('users_groups', Base.metadata, | |
Column('users_id', Integer, ForeignKey('users.id')), | |
Column('groups_id', Integer, ForeignKey('groups.id')) | |
) | |
class Users(Base): |
NewerOlder