Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View gskoljarev's full-sized avatar

Goran Školjarev gskoljarev

View GitHub Profile
@genomics-geek
genomics-geek / README.md
Last active January 10, 2024 15:27
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
#Cory Leigh Rahman
#GEOG469: Python with Dr. Bortolot
#Python 2.7.8
#This Python program converts coordinates from Degrees Minutes Seconds to Decimal Degrees and vice versa.
def end():# Class which allows the program to end
print
print "Thanks for using Cory's Latitude/Longitude Conversion Program! Goodbye."
def startover():# Class which appears at the end of calculation, allowing startover without having to rerun the program
@IamAdiSri
IamAdiSri / Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
Last active May 9, 2022 22:08 — forked from evansneath/Python3 Virtualenv Setup
Setting up and using Python3, Pip3, Virtualenv (for Python3) and Virtualenvwrapper (for Python3)
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py
$ cd <download location>
$ sudo -H python ./get-pip.py
Installing pip also installs Python3
To run Python3
$ python3
Install pip3 by just executing the same file as in the step above, but this time using Python3
$ sudo -H python3 ./get-pip.py
@vladiibine
vladiibine / swap_django_auth_user.md
Last active March 9, 2020 20:59
Swap django auth.User with custom model after having applied the 0001_initial migration

Swapping the django user model during the lifecycle of a project (django 1.8 guide)

I've come to a point where I had to swap django's user model with a custom one, at a point when I already had users, and already had apps depending on the model. Therefore this guide is trying to provide the support that is not found in the django docs.

Django warns that this should only be done basically at the start of a project, so that the initial migration of an app includes the creation of the custom user model. It took a while to do, and I ran into problems created by the already existing relations between other models and auth.User.

There were good and not so good things regarding my project state, that influenced the difficulty of the job.

Things that made the swap simpler
  1. My custom user also had an id field, that's just a usual default django id
@alecxe
alecxe / runner.py
Last active August 23, 2023 14:19
Self-contained minimum example script to run scrapy
import json
from scrapy.crawler import Crawler
from scrapy.contrib.loader import ItemLoader
from scrapy.contrib.loader.processor import Join, MapCompose, TakeFirst
from scrapy import log, signals, Spider, Item, Field
from scrapy.settings import Settings
from twisted.internet import reactor
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@msbarry
msbarry / README.md
Last active September 13, 2023 18:34
Visvalingam vs. Douglas-Peucker

Two well-known algorithms for polyline simplification are the Douglas Peucker and Visvalingam algorithms.

The Douglas Peucker algorithm uses a recursive divide-and-conquer approach. It starts by drawing a straight line from the first point to the last point. Then it finds the intermediate point that is furthest away from the straight line and deems this the "most important" and splits the polyline into two halves at that point. This process is repeated on both halves until the distance of the intermediate point is below a certain threshold, after which all points on that sub-polyline are thrown away since they have a negligible impact on the overall shape.

The Visvalingam algorithm works from the inside-out. It starts by computing the area of the triangle formed by each consecutive three points along the polyline. Then the midpoint of the triangle with the least area is thrown out since those three points are the closest to colinear and the area of triangles on either side are recomputed. The process