Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ma1onso's full-sized avatar
💜

Alonso ma1onso

💜
View GitHub Profile
[{'clicks': '37',
'cost': '3456000000',
'impressions': '126',
'conversions': '6.00',
'allConv': '7.00',
'network': 'Search Network',
'device': 'Computers',
'campaignState': 'enabled'},
{'clicks': '2',
'cost': '719000000',
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Laptop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
CPU Family: 0x6
@ma1onso
ma1onso / how-to-configure-pem-file.txt
Last active June 5, 2018 15:56
how to configure pem file
Nota: Todos estos pasos se deben hacer antes de bloquear el acceso con contraseña al servidor.
Pasos para crear deploy keys y fichero .pem:
ssh-keygen -t rsa -b 4096
cd ~/.ssh && openssl rsa -in id_rsa -outform pem > test.pem
cat id_rsa.pub >> authorized_keys
Referencia: https://thepracticalsysadmin.com/set-up-pem-key-authentication/
@ma1onso
ma1onso / faces.py
Last active December 4, 2017 20:16
Count faces
from cv2 import imread, cvtColor, CascadeClassifier, COLOR_BGR2GRAY, CASCADE_SCALE_IMAGE
HAARCASCADE_FRONTALFACE = '{base_path}/cascades/haarcascade_frontalface_default.xml'.format(
base_path=os.path.abspath(os.path.dirname(__file__).replace('configs', ''))
)
num_faces = 0
locations = []
image = imread ('PATH/TO/IMAGE')
@ma1onso
ma1onso / uwsgi.ini
Last active March 11, 2017 02:42
.ini file for uwsgi configurations - Django
# adboozter_uwsgi.ini file
[uwsgi]
project = NAME
base = /home/USER
# Django-related settings
# the base directory (full path)
chdir = %(base)/www/%(project)
# Django's wsgi file
@ma1onso
ma1onso / supervisor_project.conf
Last active March 11, 2017 04:04
Supervisor programs - uwsgi, celery and celery_beat
# Place this data inside /etc/supervisor/conf.d/project.conf
[program:uwsgi]
command=/home/user/.virtualenvs/project/bin/uwsgi --ini project_uwsgi.ini
stdout_logfile=/home/user/logs/uwsgi/output.log
stderr_logfile=/home/user/logs/uwsgi/error.log
autostart=true
autorestart=true
stopsignal=INT
@ma1onso
ma1onso / nginx.site.conf
Last active March 11, 2017 00:44
Clean and basic nginx site configuration - UWSGI and Django
upstream project_app {
server unix:///home/USER/project.sock;
}
server {
server_name www.example.com;
charset utf-8;
root /home/USER/www/path/to/project;
@ma1onso
ma1onso / gist:4171a47506dbfb7a3e9851268b265550
Last active September 28, 2016 06:28
Conectarme a psql y eliminar historical migration
Conectarse a PSQL: sudo -u postgres psql -d finance
Eliminar:
DROP TABLE django_admin_log;
DELETE FROM django_migrations WHERE app = 'admin';
@ma1onso
ma1onso / settings.py
Created January 14, 2016 15:56
Celery and Redis config in Django settings.py
# Celery
BROKER_URL = "redis://127.0.0.1:6379/0"
CELERY_SEND_EVENTS = True
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/0'
# CELERY_TASK_RESULT_EXPIRES = 60
CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
CELERY_IMPORTS = (
'another_module_with_task',
)
@ma1onso
ma1onso / celery.py
Created January 14, 2016 15:36
Example for celery.py file
# coding=utf-8
from __future__ import absolute_import
import os
from django.conf import settings
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')