Skip to content

Instantly share code, notes, and snippets.

View mssobhan's full-sized avatar

Sakhawat Sobhan Gorky mssobhan

View GitHub Profile
#! /bin/bash
SCRIPT=("mongod")
PID=$(ps aux | grep -v grep | grep $SCRIPT | awk '{print $2}')
if [[ -z "$PID" ]]
then
nohup /opt/mongo30/mongodb/bin/mongod --dbpath /var/lib/mongodb/ --storageEngine wiredTiger --port 27017 &
else
from lxml import html
import requests
from bs4 import BeautifulSoup
import xlsxwriter
import re
from slimit import ast
from slimit.parser import Parser
from slimit.visitors import nodevisitor
from datetime import datetime
from PIL import Image,ImageDraw, ImageFont, ImageEnhance
def image_watermark(request,image_id):
photo = Photo.objects.get(pk=image_id)
basewidth = 640
watermark = Image.open('{0}/{1}'.format(settings.MEDIA_ROOT,'art1.png'))
img = Image.open(photo.photo.file)
wpercent = (basewidth/float(img.size[0]))
hsize = int((float(wpercent)*float(img.size[1])))
img = img.resize((basewidth,hsize),Image.ANTIALIAS)
$scope.substr = function(string, start, end) {
return string.substr(start, end);
}
$scope.split = function(string, nb) {
var array = string.split(',');
return array[nb];
}
/*