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
#!/usr/bin/env python | |
# -*- coding: utf-8 | |
# Copyright (C) 2014, A. Murat Eren | |
# | |
# This program is free software; you can redistribute it and/or modify it under | |
# the terms of the GNU General Public License as published by the Free | |
# Software Foundation; either version 2 of the License, or (at your option) | |
# any later version. | |
# |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Special | |
{ | |
class Program | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace StandardDeviation | |
{ | |
public static class Program | |
{ |
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 ftplib | |
def directory_list(): | |
ftp = ftplib.FTP("yourdomain.com") | |
ftp.login("username", "password") | |
data = [] | |
ftp.dir(data.append) | |
ftp.quit() |
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 ftplib | |
def ftp_upload(): | |
ftp = ftplib.FTP("yourdomain.com") | |
ftp.login("ftp_username", "ftp_password") | |
upload_file = "/full/path/your/file.txt" | |
ftp.storlines("STOR " + upload_file, open(upload_file)) | |
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 os | |
import PIL | |
from PIL import Image | |
def image_resizer(path): | |
img = Image.open(path) | |
basewidth = 700 |
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 PIL import Image, ImageEnhance | |
def reduce_opacity(im, opacity): | |
"""Returns an image with reduced opacity.""" | |
assert opacity >= 0 and opacity <= 1 | |
if im.mode != 'RGBA': | |
im = im.convert('RGBA') | |
else: | |
im = im.copy() |
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 base64 | |
import datetime | |
def activation_key_generator(email): | |
expire_date = datetime.datetime.today() + datetime.timedelta(3) | |
activation_key = base64.b64encode( | |
str(expire_date)) + base64.b64encode( | |
str(email)).split('=')[0] | |
return activation_key |
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 django.core.mail import EmailMultiAlternatives | |
from django.template import Context | |
from django.template.loader import render_to_string | |
from django.http import HttpResponse | |
from django.utils.translation import ugettext as _ | |
from .util_token_generator import activation_key_generator | |
def mail_sender(email, controll): |
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
# django settings.py | |
... | |
MAIL_PASSWD = "Your-Mail-Passwd" | |
# Email setup | |
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |
EMAIL_USE_TLS = True | |
EMAIL_HOST = 'smtp.gmail.com' | |
EMAIL_HOST_USER = 'your@mail.com' |
OlderNewer