Skip to content

Instantly share code, notes, and snippets.

View MySecondLanguage's full-sized avatar
🏠
Working from home

pydude MySecondLanguage

🏠
Working from home
  • N/A
  • Dhaka, BD
View GitHub Profile

Django Ajax Image/file Upload

` Upload image directly to server without any page reload with ajax.

Here is a nutshell of uploading image in django with ajax `

models

@MySecondLanguage
MySecondLanguage / settings.py
Created February 14, 2020 14:25 — forked from andreagrandi/settings.py
Sending emails from Django during development without using a real SMTP server. Python comes with a very basic and integrated SMTP server. To start it just open a terminal and type: python -m smtpd -n -c DebuggingServer localhost:1025 Then configure your settings.py using the following parameters. You will see the email directly in the terminal …
if DEBUG:
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
DEFAULT_FROM_EMAIL = 'testing@example.com'
version: '2.0'
services:
postgres:
image: postgres
container_name: mamun-db
working_dir: /usr/src/app
volumes:
- ./data:/usr/src/app
environment:
#facebook marketplace
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from pymongo import MongoClient
class App:
@MySecondLanguage
MySecondLanguage / README.md
Last active October 11, 2019 02:05
A quick tips to ubuntu beginner to get better user experience!

Guide on ubuntu to get better user experience !

We assume you have installed ubuntu 16 or newer version. to get better option, please install ubutn as lagacy mode: here you go for ths tutorial Install Ubuntu in lagacy mode

During installation, make sure you have customized your partision in better way. check the following checklist during partition.

  • You have give size to SWAP as much campacity as your RAM has
  • Give HOME size highest
@MySecondLanguage
MySecondLanguage / README.md
Created September 14, 2019 04:54 — forked from genomics-geek/README.md
Setting up a Dockerized web application with Django REST APIs, ReactJS with Redux pattern, and Webpack Hot Reloading! Mouthful.

Guide on how to create and set up a Dockerized web app using Django REST APIs and ReactJS

Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"

This is a guide to show you step by step how this can be setup. If you just want to get started, use the cookiecuter I set up cookiecutter-django-reactjs. It basically is a fork of pydanny's cookiecutter, just added the front-end stuff :).

I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)

Main features:

  • Django REST APIs
@MySecondLanguage
MySecondLanguage / plag.py
Created July 24, 2019 18:21 — forked from Ghost---Shadow/plag.py
Using NLTK to replace all words in a string with their synonyms.
from nltk.corpus import wordnet
from nltk.tokenize import word_tokenize
from random import randint
import nltk.data
# Load a text file if required
text = "Pete ate a large cake. Sam has a big mouth."
output = ""
# Load the pretrained neural net
@MySecondLanguage
MySecondLanguage / image_scrapper.py
Created January 5, 2019 11:18 — forked from DollarAkshay/image_scrapper.py
Image Scraper in Python
import cv2
import numpy as np
import urllib.request
import time
start_time = time.time()
for i in range(1, 51):
try:
req = urllib.request.Request(
'https://assets.pokemon.com/assets/cms2/img/pokedex/detail/' + '{:03d}'.format(i) + '.png')
@MySecondLanguage
MySecondLanguage / bulk_image_resize.py
Created January 4, 2019 13:37 — forked from kishstats/bulk_image_resize.py
Python Bulk Image Resize
import os
import argparse
from PIL import Image
DEFAULT_SIZE = (320, 180)
def resize_image(input_dir, infile, output_dir="resized", size=DEFAULT_SIZE):
outfile = os.path.splitext(infile)[0] + "_resized"
extension = os.path.splitext(infile)[1]