Skip to content

Instantly share code, notes, and snippets.

View alexander-ae's full-sized avatar

Alexander alexander-ae

View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" DMLogger """
import tkinter as tk
import tkinter.scrolledtext as tkscrolledtext
import http.server as httpserver
import _thread as thread
import sqlite3
import json
from urllib import parse
@alexander-ae
alexander-ae / punto_en_poligono.py
Created February 27, 2018 22:01
Script para verificar si un punto pertenece a un polígono en base a https://en.wikipedia.org/wiki/Point_in_polygon#Ray_casting_algorithm
import sys
def punto_en_poligono(poly, p_x, p_y):
res = "Citizen"
count = 0
cantidad_de_vertices = len(poly)
p_x1, p_y1 = poly[0]
for i in range(cantidad_de_vertices):
@alexander-ae
alexander-ae / gist:17c1aa8498bec86e48b47ce03ad7d494
Created February 17, 2017 19:41 — forked from jdiscar/gist:9144764
RGB Value to Nearest Color Name (Python)
"""
Original Author Ernesto P. Adorio, Ph.D
Original Source: http://my-other-life-as-programmer.blogspot.com/2012/02/python-finding-nearest-matching-color.html
Modifed By: JDiscar
This class maps an RGB value to the nearest color name it can find. Code is modified to include
ImageMagick names and WebColor names.
1. Modify the minimization criterion to use least sum of squares of the differences.
2. Provide error checking for input R, G, B values to be within the interval [0, 255].
@alexander-ae
alexander-ae / web.conf
Created December 23, 2016 17:17
Nginx: symfony + wordpress
server {
listen 80 default_server;
root /var/www/html/proyecto/web;
index index.php index.html index.htm index.nginx-debian.html;
location /blog {
try_files $uri $uri/ @wordpress;
}
location @wordpress {
@alexander-ae
alexander-ae / script
Created October 14, 2016 17:14
stylus
stylus -c -u nib -w src/static/styl/ -o src/static/css/
@alexander-ae
alexander-ae / force_default_middleware.py
Created October 6, 2016 21:47 — forked from vstoykov/force_default_language_middleware.py
Force django to use settings.LANGUAGE_CODE for default language and not use equest.META['HTTP_ACCEPT_LANGUAGE']
class ForceDefaultLanguageMiddleware(object):
"""
Ignore Accept-Language HTTP headers
This will force the I18N machinery to always choose settings.LANGUAGE_CODE
as the default initial language, unless another one is set via sessions or cookies
Should be installed *before* any middleware that checks request.META['HTTP_ACCEPT_LANGUAGE'],
namely django.middleware.locale.LocaleMiddleware
"""
@alexander-ae
alexander-ae / killall.sh
Created April 7, 2016 15:53
kill all process by pattern
ps -ef | grep myProcessName | grep -v grep | awk '{print $2}' | xargs kill -9
@alexander-ae
alexander-ae / settings.py
Created December 13, 2015 02:14 — forked from ndarville/settings.py
Django on Travis CI
"""A basic database set-up for Travis CI.
The set-up uses the 'TRAVIS' (== True) environment variable on Travis
to detect the session, and changes the default database accordingly.
Be mindful of where you place this code, as you may accidentally
assign the default database to another configuration later in your code.
"""
import os
@alexander-ae
alexander-ae / install-comodo-ssl-cert-for-nginx.rst
Created October 12, 2015 22:59 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert