Skip to content

Instantly share code, notes, and snippets.

View sdcasas's full-sized avatar

Sergio Daniel sdcasas

View GitHub Profile
@sdcasas
sdcasas / django.sh
Last active February 13, 2025 14:44
SpatiaLite requires SQLite to be configured to allow
# ejecutando los test de un proyecto en django con base de datos espacial me encuentro con estos errores
AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension'
django.core.exceptions.ImproperlyConfigured: SpatiaLite requires SQLite to be configured to allow extension loading
# SOLUCION: (en mi caso uso pyenv + virtualenv para encapsular el proyecto)
source deactivate
# ________________________________________________________________________________
# all --> and
# any --> or
# False
all([True, True, False])
# True
any([True, True, False])

pyenv cheatsheet

pyenv

pyenv install

List available python versions:

    $ pyenv install -l

Install Python 3.5.1:

import time
import pytz
from datetime import datetime, timedelta
# str to datetime
datetime_str = '09/19/18 13:55:26'
datetime_object = datetime.strptime(datetime_str, '%m/%d/%y %H:%M:%S')
# str to time
# for run install:
# pip install filelock
import os
import filelock
from contextlib import contextmanager
@contextmanager

instalar los paquetes openvpn y pptp-linux que añaden el demonio VPN y el protocolo «Point-to-Point Tunneling»:

#
apt-get install openvpn pptp-linux vpnc vpnc-scripts

Para poder configurar la conexión desde el network manager, el gestor de conexiones de red de gnome, hay que instalar otros dos paquetes:

#
apt-get install network-manager-openvpn-gnome network-manager-pptp-gnome network-manager-vpnc-gnome
# source: https://www.vozidea.com/velocidad-de-la-conexion-desde-terminal-linux
# Download source code
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
# give permission run
sudo chmod +x speedtest-cli
# runing
./speedtest-cli

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# django orm DateTimeField = DateField +TimeField
# models.py
class Sesion(models.Model):
fecha = models.DateField(null=True, blank=True)
hora = models.TimeField(null=True, blank=True)
class ProyectoEstado(models.Model):
fecha_cambio_estado = models.DateTimeField()
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true